pulumi/sdk
bors[bot] 7efd298867
Merge #11829 #11833
11829: golangci-lint: Don't disable megacheck r=abhinav a=abhinav

As a pre-step to enabling staticcheck (#11808)
drop megacheck from the list of disabled linters.

This was suppressing the output of some other linters
that are enabled by default including gosimple and unused.

## Issues fixed

### pkg

```
cmd/pulumi/preview.go:199:4: S1011: should replace loop with `targetURNs = append(targetURNs, targets...)` (gosimple)
cmd/pulumi/preview.go:204:4: S1011: should replace loop with `replaceURNs = append(replaceURNs, replaces...)` (gosimple)
cmd/pulumi/refresh.go:248:4: S1011: should replace loop with `targetUrns = append(targetUrns, *targets...)` (gosimple)
cmd/pulumi/up.go:130:3: S1011: should replace loop with `targetURNs = append(targetURNs, targets...)` (gosimple)
cmd/pulumi/up.go:134:3: S1011: should replace loop with `replaceURNs = append(replaceURNs, replaces...)` (gosimple)
resource/stack/deployment.go:61:5: var `resourceSchema` is unused (unused)
codegen/hcl2/model/pretty/display.go:227:6: S1003: should use strings.ContainsRune(v, '\n') instead (gosimple)
codegen/hcl2/model/pretty/display.go:289:6: S1003: should use strings.ContainsRune(v, '\n') instead (gosimple)
codegen/nodejs/gen.go:110:2: S1029: should range over string, not []rune(string) (gosimple)
codegen/nodejs/gen_program.go:381:2: S1008: should use 'return makeValidIdentifier(outputName) != outputName' instead of 'if makeValidIdentifier(outputName) != outputName { return true }; return false' (gosimple)
codegen/go/gen_program_json.go:30:2: field `temps` is unused (unused)
codegen/go/gen_program_json.go:34:24: func `(*jsonSpiller).spillExpression` is unused (unused)
codegen/go/gen_program_json.go:12:6: type `jsonTemp` is unused (unused)
codegen/go/gen_program_expressions.go:542:21: func `(*generator).genRelativeTraversalExpression` is unused (unused)
codegen/go/gen_program_json.go:21:21: func `(*jsonTemp).Traverse` is unused (unused)
codegen/go/gen_program_json.go:31:2: field `count` is unused (unused)
codegen/go/gen_program.go:484:21: func `(*generator).getPkgContext` is unused (unused)
codegen/go/gen_program_json.go:17:21: func `(*jsonTemp).Type` is unused (unused)
codegen/go/gen_program_json.go:25:21: func `(*jsonTemp).SyntaxNode` is unused (unused)
codegen/go/gen_test.go:399:4: S1023: redundant break statement (gosimple)
codegen/python/gen_program.go:337:41: S1040: type assertion to the same type: destType already has type model.Type (gosimple)
backend/display/jsonmessage.go:176:27: func `(*messageRenderer).writeBlankLine` is unused (unused)
backend/display/progress.go:1239:21: S1012: should use `time.Since` instead of `time.Now().Sub` (gosimple)
codegen/hcl2/syntax/tokens.go:265:2: S1001: should use copy() instead of a loop (gosimple)
testing/integration/util.go:195:2: S1006: should use for {} instead of for true {} (gosimple)
testing/integration/program.go:456:3: S1011: should replace loop with `opts.OrderedConfig = append(opts.OrderedConfig, overrides.OrderedConfig...)` (gosimple)
testing/integration/program.go:690:3: S1038: should use t.Skipf(...) instead of t.Skip(fmt.Sprintf(...)) (gosimple)
codegen/dotnet/gen_program.go:255:21: func `(*generator).warnf` is unused (unused)
codegen/dotnet/gen.go:62:2: S1017: should replace this `if` statement with an unconditional `strings.TrimPrefix` (gosimple)
codegen/dotnet/gen_program.go:515:41: S1040: type assertion to the same type: destType already has type model.Type (gosimple)
codegen/schema/loader.go:116:9: S1039: unnecessary use of fmt.Sprintf (gosimple)
```

### sdk

```
python/cmd/pulumi-language-python/main.go:532:3: S1029: should range over string, not []rune(string) (gosimple)
go/common/resource/plugin/context.go:145:8: S1005: unnecessary assignment to the blank identifier (gosimple)
go/common/resource/plugin/context.go:144:3: S1000: should use a simple channel send/receive instead of `select` with a single case (gosimple)
go/common/util/env/env.go:198:9: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
go/pulumi/resource_set.go:9:22: func `resourceSet.any` is unused (unused)
go/pulumi/resource_set.go:17:22: func `resourceSet.has` is unused (unused)
go/pulumi/resource_set.go:13:22: func `resourceSet.delete` is unused (unused)
go/pulumi/types_test.go:444:12: S1040: type assertion to the same type: argsV.R already has type Resource (gosimple)
go/auto/stack.go:153:2: S1021: should merge variable declaration with assignment on next line (gosimple)
go/auto/stack.go:170:2: S1021: should merge variable declaration with assignment on next line (gosimple)
go/common/resource/asset_test.go:391:6: func `findRepositoryRoot` is unused (unused)
go/common/util/goversion/version.go:32:2: S1017: should replace this `if` statement with an unconditional `strings.TrimPrefix` (gosimple)
```

### tests

There were a couple functions marked unused
that are used by tests that are currently skipped.
I've added `//nolint:unused` for those.


11833: crypto/ssh/terminal is deprecated r=abhinav a=abhinav

golang.org/x/crypto/ssh/terminal is deprecated.
golang.org/x/term is a near drop-in replacement for it.

In service to #11808


Co-authored-by: Abhinav Gupta <abhinav@pulumi.com>
2023-01-11 22:30:25 +00:00
..
go Merge #11829 #11833 2023-01-11 22:30:25 +00:00
nodejs grpc: WithInsecure is deprecated 2023-01-11 12:15:40 -08:00
proto Update Go gRPC, require impl to embed UnimplementedXServer 2023-01-05 18:00:16 -08:00
python Merge #11829 #11833 2023-01-11 22:30:25 +00:00
README.md Cleanup sdk/README.md 2023-01-03 17:12:12 -05:00
go.mod Update Go gRPC, require impl to embed UnimplementedXServer 2023-01-05 18:00:16 -08:00
go.sum Update Go gRPC, require impl to embed UnimplementedXServer 2023-01-05 18:00:16 -08:00

README.md

Pulumi Language SDKs

This directory contains Pulumi SDKs for the following languages:

See the respective READMEs for information about installing and using these libraries.

The language providers work by implementing gRPC interfaces defined in the top level directory proto.