googleapis / googleapis/google-cloud-go
add staticcheck as a presubmit check
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 1.6k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 109
Description
[staticcheck](https://staticcheck.io/) is a common linter for Go projects. We should consider adding it as a presubmit check for PRs. See https://github.com/googleapis/gapic-generator-go/issues/1404 and https://github.com/googleapis/gapic-showcase/issues/1529 for related issues.
This first requires fixing these issues in this repository:
```
$ staticcheck ./...
debugger/apiv2/controller2_client.go:23:2: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package [io] or package [os], and those implementations should be preferred in new code. See the specific function documentation for details. (SA1019)
debugger/apiv2/controller2_client.go:53:3: internaloption.WithDefaultEndpoint is deprecated: WithDefaultEndpoint does not support setting the universe domain. Use WithDefaultEndpointTemplate and WithDefaultUniverseDomain to compose the default endpoint instead. (SA1019)
debugger/apiv2/controller2_client.go:386:3: internaloption.WithDefaultEndpoint is deprecated: WithDefaultEndpoint does not support setting the universe domain. Use WithDefaultEndpointTemplate and WithDefaultUniverseDomain to compose the default endpoint instead. (SA1019)
debugger/apiv2/debugger2_client.go:23:2: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package [io] or package [os], and those implementations should be preferred in new code. See the specific function documentation for details. (SA1019)
debugger/apiv2/debugger2_client.go:55:3: internaloption.WithDefaultEndpoint is deprecated: WithDefaultEndpoint does not support setting the universe domain. Use WithDefaultEndpointTemplate and WithDefaultUniverseDomain to compose the default endpoint instead. (SA1019)
debugger/apiv2/debugger2_client.go:394:3: internaloption.WithDefaultEndpoint is deprecated: WithDefaultEndpoint does not support setting the universe domain. Use WithDefaultEndpointTemplate and WithDefaultUniverseDomain to compose the default endpoint instead. (SA1019)
debugger/apiv2/debugger2_client.go:715:5: req.GetStripResults is deprecated: Do not use. (SA1019)
debugger/apiv2/debugger2_client.go:716:48: req.GetStripResults is deprecated: Do not use. (SA1019)
httpreplay/internal/proxy/debug.go:24:6: type debugTransport is unused (U1000)
httpreplay/internal/proxy/debug.go:29:25: func debugTransport.RoundTrip is unused (U1000)
httpreplay/internal/proxy/debug.go:46:6: func logHeaders is unused (U1000)
internal/btree/btree.go:579:33: field byte is unused (U1000)
internal/btree/btree_test.go:32:2: rand.Seed has been deprecated since Go 1.20 and an alternative has been available since Go 1.0: As of Go 1.20 there is no reason to call Seed with a random value. Programs that call Seed with a known value to get a specific sequence of results should use New(NewSource(seed)) to obtain a local random generator. (SA1019)
internal/testutil/server_test.go:32:15: grpc.Dial is deprecated: use NewClient instead. Will be supported throughout 1.x. (SA1019)
internal/testutil/server_test.go:32:35: grpc.WithInsecure is deprecated: use WithTransportCredentials and insecure.NewCredentials() instead. Will be supported throughout 1.x. (SA1019)
rpcreplay/example_test.go:34:15: grpc.Dial is deprecated: use NewClient instead. Will be supported throughout 1.x. (SA1019)
rpcreplay/example_test.go:47:15: grpc.Dial is deprecated: use NewClient instead. Will be supported throughout 1.x. (SA1019)
rpcreplay/rpcreplay.go:372:3: grpc.WithBlock is deprecated: this DialOption is not supported by NewClient. Will be supported throughout 1.x. (SA1019)
rpcreplay/rpcreplay.go:393:15: grpc.Dial is deprecated: use NewClient instead. Will be supported throughout 1.x. (SA1019)
rpcreplay/rpcreplay.go:394:28: grpc.WithInsecure is deprecated: use WithTransportCredentials and insecure.NewCredentials() instead. Will be supported throughout 1.x. (SA1019)
rpcreplay/rpcreplay_test.go:259:15: grpc.Dial is deprecated: use NewClient instead. Will be supported throughout 1.x. (SA1019)
rpcreplay/rpcreplay_test.go:260:28: grpc.WithInsecure is deprecated: use WithTransportCredentials and insecure.NewCredentials() instead. Will be supported throughout 1.x. (SA1019)
rpcreplay/rpcreplay_test.go:461:17: grpc.DialContext is deprecated: use NewClient instead. Will be supported throughout 1.x. (SA1019)
rpcreplay/rpcreplay_test.go:461:74: grpc.WithInsecure is deprecated: use WithTransportCredentials and insecure.NewCredentials() instead. Will be supported throughout 1.x. (SA1019)
rpcreplay/rpcreplay_test.go:551:17: grpc.DialContext is deprecated: use NewClient instead. Will be supported throughout 1.x. (SA1019)
rpcreplay/rpcreplay_test.go:551:74: grpc.WithInsecure is deprecated: use WithTransportCredentials and insecure.NewCredentials() instead. Will be supported throughout 1.x. (SA1019)
rpcreplay/rpcreplay_test.go:572:16: grpc.DialContext is deprecated: use NewClient instead. Will be supported throughout 1.x. (SA1019)
rpcreplay/rpcreplay_test.go:572:73: grpc.WithInsecure is deprecated: use WithTransportCredentials and insecure.NewCredentials() instead. Will be supported throughout 1.x. (SA1019)
third_party/pkgsite/synopsis.go:64:5: the surrounding loop is unconditionally terminated (SA4004)
```
Contributor guide
Assessment
This issue has not been assessed yet.