Skip to content

Commit

Permalink
Address revive lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
justinvp committed Dec 27, 2023
1 parent a7e9c6d commit 2409c1d
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
10 changes: 5 additions & 5 deletions pkg/cmd/pulumi-language-java/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ type javaCommandResponse struct {
}

func (host *javaLanguageHost) runJavaCommand(
ctx context.Context, dir, name string, args []string, quiet bool,
_ context.Context, dir, name string, args []string, quiet bool,
) (javaCommandResponse, error) {
commandStr := strings.Join(args, " ")
if logging.V(5) {
Expand Down Expand Up @@ -278,7 +278,7 @@ func (host *javaLanguageHost) runJavaCommand(
}

// Run is an RPC endpoint for LanguageRuntimeServer::Run
func (host *javaLanguageHost) Run(ctx context.Context, req *pulumirpc.RunRequest) (*pulumirpc.RunResponse, error) {
func (host *javaLanguageHost) Run(_ context.Context, req *pulumirpc.RunRequest) (*pulumirpc.RunResponse, error) {
logging.V(5).Infof("Run: program=%v", req.GetProgram()) //nolint:staticcheck

config, err := host.constructConfig(req)
Expand Down Expand Up @@ -391,7 +391,7 @@ func (host *javaLanguageHost) constructConfigSecretKeys(req *pulumirpc.RunReques
return string(configSecretKeysJSON), nil
}

func (host *javaLanguageHost) GetPluginInfo(ctx context.Context, req *pbempty.Empty) (*pulumirpc.PluginInfo, error) {
func (host *javaLanguageHost) GetPluginInfo(_ context.Context, _ *pbempty.Empty) (*pulumirpc.PluginInfo, error) {
return &pulumirpc.PluginInfo{
Version: version.Version,
}, nil
Expand Down Expand Up @@ -437,13 +437,13 @@ func (host *javaLanguageHost) InstallDependencies(req *pulumirpc.InstallDependen
}

func (host *javaLanguageHost) GetProgramDependencies(
ctx context.Context, req *pulumirpc.GetProgramDependenciesRequest,
_ context.Context, _ *pulumirpc.GetProgramDependenciesRequest,
) (*pulumirpc.GetProgramDependenciesResponse, error) {
// TODO: Implement dependency fetcher for Java
return &pulumirpc.GetProgramDependenciesResponse{}, nil
}

func (host *javaLanguageHost) About(ctx context.Context, req *emptypb.Empty) (*pulumirpc.AboutResponse, error) {
func (host *javaLanguageHost) About(_ context.Context, _ *emptypb.Empty) (*pulumirpc.AboutResponse, error) {
getResponse := func(execString string, args ...string) (string, string, error) {
ex, err := executable.FindExecutable(execString)
if err != nil {
Expand Down
16 changes: 8 additions & 8 deletions pkg/codegen/java/doc_language_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ func (d DocLanguageHelper) GetPropertyName(p *schema.Property) (string, error) {
return names.Ident(p.Name).AsProperty().Getter(), nil
}

func (d DocLanguageHelper) GetFunctionName(modName string, f *schema.Function) string {
func (d DocLanguageHelper) GetFunctionName(_ string, f *schema.Function) string {
return tokenToFunctionName(f.Token)
}

func (d DocLanguageHelper) GetResourceFunctionResultName(modName string, f *schema.Function) string {
func (d DocLanguageHelper) GetResourceFunctionResultName(_ string, f *schema.Function) string {
return tokenToFunctionResultClassName(nil, f.Token).String()
}

Expand All @@ -59,7 +59,7 @@ func (d DocLanguageHelper) GetMethodName(m *schema.Method) string {
}

func (d DocLanguageHelper) GetMethodResultName(
pkg *schema.Package, modName string, r *schema.Resource, m *schema.Method,
_ *schema.Package, _ string, _ *schema.Resource, m *schema.Method,
) string {
// TODO revise when method support is built, revise when output-versioned functions are built
return tokenToFunctionResultClassName(nil, m.Function.Token).String()
Expand Down Expand Up @@ -87,26 +87,26 @@ func (d DocLanguageHelper) GetEnumName(e *schema.Enum, typeName string) (string,
// Context, BucketArgs and ResourceOption get linked to Go API docs.
//
// For Java we could link to JavaDoc when appropriate.
func (d DocLanguageHelper) GetDocLinkForPulumiType(pkg *schema.Package, typeName string) string {
func (d DocLanguageHelper) GetDocLinkForPulumiType(_ *schema.Package, _ string) string {
return ""
}

func (d DocLanguageHelper) GetDocLinkForResourceType(pkg *schema.Package, modName, typeName string) string {
func (d DocLanguageHelper) GetDocLinkForResourceType(_ *schema.Package, _, _ string) string {
panic("Not implemented")
}

func (d DocLanguageHelper) GetDocLinkForResourceInputOrOutputType(
pkg *schema.Package, modName, typeName string, input bool,
_ *schema.Package, _, _ string, _ bool,
) string {
panic("Not implemented")
}

func (d DocLanguageHelper) GetDocLinkForFunctionInputOrOutputType(
pkg *schema.Package, modName, typeName string, input bool,
_ *schema.Package, _, _ string, _ bool,
) string {
panic("Not implemented")
}

func (d DocLanguageHelper) GetModuleDocLink(pkg *schema.Package, modName string) (string, string) {
func (d DocLanguageHelper) GetModuleDocLink(_ *schema.Package, _ string) (string, string) {
panic("Not implemented")
}
4 changes: 2 additions & 2 deletions pkg/codegen/java/gen_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ func (dg *defaultsGen) builderExpr(
// Degenerate cases can have simpler code.
func (dg *defaultsGen) builderExprSpecialCase(
prop *schema.Property,
targetType TypeShape,
config string,
_ TypeShape,
_ string,
arg string,
) (string, bool) {
// No defaults, no null check, already have an argument of wanted type, simply pass it on.
Expand Down
2 changes: 1 addition & 1 deletion pkg/codegen/java/gen_program.go
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ func (g *generator) genPreamble(w io.Writer, nodes []pcl.Node) {
}

// genPostamble closes the method and the class and declares stack output statements.
func (g *generator) genPostamble(w io.Writer, nodes []pcl.Node) {
func (g *generator) genPostamble(w io.Writer, _ []pcl.Node) {
g.Indented(func() {
g.genIndent(w)
g.Fgen(w, "}\n")
Expand Down
8 changes: 4 additions & 4 deletions pkg/codegen/java/gen_program_expressions.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (g *generator) GenConditionalExpression(w io.Writer, expr *model.Conditiona
g.Fgenf(w, "%.4v ? %.4v : %.4v", expr.Condition, expr.TrueResult, expr.FalseResult)
}

func (g *generator) GenForExpression(w io.Writer, expr *model.ForExpression) {
func (g *generator) GenForExpression(w io.Writer, _ *model.ForExpression) {
g.genNYI(w, "ForExpression") // TODO
}

Expand Down Expand Up @@ -621,7 +621,7 @@ func (g *generator) genObjectConsExpressionWithTypeName(
}

func (g *generator) genRelativeTraversal(w io.Writer,
traversal hcl.Traversal, parts []model.Traversable, objType *schema.ObjectType,
traversal hcl.Traversal, _ []model.Traversable, _ *schema.ObjectType,
) {
for _, part := range traversal {
var key cty.Value
Expand Down Expand Up @@ -686,7 +686,7 @@ func (g *generator) GenSplatExpression(w io.Writer, expr *model.SplatExpression)
g.Fgenf(w, "%.20v.stream().map(element -> element%.v).collect(toList())", expr.Source, expr.Each)
}

func (g *generator) GenTemplateJoinExpression(w io.Writer, expr *model.TemplateJoinExpression) {
func (g *generator) GenTemplateJoinExpression(w io.Writer, _ *model.TemplateJoinExpression) {
g.genNYI(w, "TemplateJoinExpression")
}

Expand Down Expand Up @@ -784,6 +784,6 @@ func (g *generator) GenTupleConsExpression(w io.Writer, expr *model.TupleConsExp
}
}

func (g *generator) GenUnaryOpExpression(w io.Writer, expr *model.UnaryOpExpression) {
func (g *generator) GenUnaryOpExpression(w io.Writer, _ *model.UnaryOpExpression) {
g.genNYI(w, "GenUnaryOpExpression") // TODO
}
12 changes: 6 additions & 6 deletions pkg/codegen/java/importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ var Importer schema.Language = importer(0)
type importer int

// ImportDefaultSpec decodes language-specific metadata associated with a DefaultValue.
func (importer) ImportDefaultSpec(def *schema.DefaultValue, raw json.RawMessage) (interface{}, error) {
func (importer) ImportDefaultSpec(_ *schema.DefaultValue, raw json.RawMessage) (interface{}, error) {
return raw, nil
}

// ImportPropertySpec decodes language-specific metadata associated with a Property.
func (importer) ImportPropertySpec(property *schema.Property, raw json.RawMessage) (interface{}, error) {
func (importer) ImportPropertySpec(_ *schema.Property, raw json.RawMessage) (interface{}, error) {
var info PropertyInfo
if err := json.Unmarshal([]byte(raw), &info); err != nil {
return nil, err
Expand All @@ -53,22 +53,22 @@ func (importer) ImportPropertySpec(property *schema.Property, raw json.RawMessag
}

// ImportObjectTypeSpec decodes language-specific metadata associated with a ObjectType.
func (importer) ImportObjectTypeSpec(object *schema.ObjectType, raw json.RawMessage) (interface{}, error) {
func (importer) ImportObjectTypeSpec(_ *schema.ObjectType, raw json.RawMessage) (interface{}, error) {
return raw, nil
}

// ImportResourceSpec decodes language-specific metadata associated with a Resource.
func (importer) ImportResourceSpec(resource *schema.Resource, raw json.RawMessage) (interface{}, error) {
func (importer) ImportResourceSpec(_ *schema.Resource, raw json.RawMessage) (interface{}, error) {
return raw, nil
}

// ImportFunctionSpec decodes language-specific metadata associated with a Function.
func (importer) ImportFunctionSpec(function *schema.Function, raw json.RawMessage) (interface{}, error) {
func (importer) ImportFunctionSpec(_ *schema.Function, raw json.RawMessage) (interface{}, error) {
return raw, nil
}

// ImportPackageSpec decodes language-specific metadata associated with a Package.
func (importer) ImportPackageSpec(pkg *schema.Package, raw json.RawMessage) (interface{}, error) {
func (importer) ImportPackageSpec(_ *schema.Package, raw json.RawMessage) (interface{}, error) {
var info PackageInfo
if err := json.Unmarshal([]byte(raw), &info); err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/codegen/java/names/ident.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func isLegalIdentifierPart(c rune) bool {
unicode.In(c, unicode.Letter, unicode.Digit)
}

func MakeSafeEnumName(name, typeName string) (string, error) {
func MakeSafeEnumName(name, _ string) (string, error) {
// Replace common single character enum names.
safeName := codegen.ExpandShortEnumName(name)

Expand Down

0 comments on commit 2409c1d

Please sign in to comment.