Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Internal] Bump staticcheck to 0.5.1 and add go 1.23 test coverage #1106

Merged
merged 2 commits into from
Jan 3, 2025

Conversation

mgyucht
Copy link
Contributor

@mgyucht mgyucht commented Jan 3, 2025

What changes are proposed in this pull request?

This PR updates the version of staticcheck used to the latest version (0.5.1). This is needed for compatibility with recent versions of go. When running the current version (0.4.0) using go 1.23.4, I get the following error:

panic: Cannot range over: func(yield func(K, V) bool)

goroutine 323 [running]:
honnef.co/go/tools/go/ir.(*builder).rangeStmt(0x140084a1a30, 0x14008dcd900, 0x140088cdb00, 0x0, {0x100aa3ef0, 0x140088cdb00})
        /Users/miles/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2181 +0x6dc
honnef.co/go/tools/go/ir.(*builder).stmt(0x140084a1a30, 0x14008dcd900, {0x100aa62d8?, 0x140088cdb00?})
        /Users/miles/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2394 +0x1c0
honnef.co/go/tools/go/ir.(*builder).stmtList(...)
        /Users/miles/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:847
honnef.co/go/tools/go/ir.(*builder).stmt(0x140084a1a30, 0x14008dcd900, {0x100aa5f18?, 0x14003654e10?})
        /Users/miles/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2352 +0x10c4
honnef.co/go/tools/go/ir.(*builder).buildFunction(0x140084a1a30, 0x14008dcd900)
        /Users/miles/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2464 +0x368
honnef.co/go/tools/go/ir.(*builder).buildFuncDecl(0x140084a1a30, 0x140006af5f0, 0x14003654e70)
        /Users/miles/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2501 +0x1a4
honnef.co/go/tools/go/ir.(*Package).build(0x140006af5f0)
        /Users/miles/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2605 +0x934
sync.(*Once).doSlow(0x140084de0e0?, 0x140088cd6e0?)
        /opt/homebrew/Cellar/go/1.23.4/libexec/src/sync/once.go:76 +0xf8
sync.(*Once).Do(...)
        /opt/homebrew/Cellar/go/1.23.4/libexec/src/sync/once.go:67
honnef.co/go/tools/go/ir.(*Package).Build(...)
        /Users/miles/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2523
honnef.co/go/tools/internal/passes/buildir.run(0x14003876e10)
        /Users/miles/go/pkg/mod/honnef.co/go/[email protected]/internal/passes/buildir/buildir.go:86 +0x134
honnef.co/go/tools/lintcmd/runner.(*analyzerRunner).do(0x1400387b920, {0x100aa8998?, 0x140086ef860})
        /Users/miles/go/pkg/mod/honnef.co/go/[email protected]/lintcmd/runner/runner.go:992 +0x600
honnef.co/go/tools/lintcmd/runner.genericHandle({0x100aa8998, 0x140086ef860}, {0x100aa8998?, 0x140086ef7c0?}, 0x14008dc83f0, 0x140004829b0, 0x140072dfa30)
        /Users/miles/go/pkg/mod/honnef.co/go/[email protected]/lintcmd/runner/runner.go:817 +0x10c
created by honnef.co/go/tools/lintcmd/runner.(*subrunner).runAnalyzers in goroutine 321
        /Users/miles/go/pkg/mod/honnef.co/go/[email protected]/lintcmd/runner/runner.go:1061 +0x568
exit status 2

Additionally, some things that passed linting before are no longer allowed. These have been fixed without affecting the behavior.

Note that the one version of staticcheck does not work with every go version, so I changed the dependency for tests from lint to vendor so that linting is not run on every go version that we test on.

Finally, I add unit test coverage for 1.23 and run linting and formatting with this golang version.

How is this tested?

No additional tests, but staticcheck is still enforced as part of CI.

@mgyucht mgyucht temporarily deployed to test-trigger-is January 3, 2025 09:51 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is January 3, 2025 09:51 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is January 3, 2025 09:56 — with GitHub Actions Inactive
Copy link

github-actions bot commented Jan 3, 2025

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-go

Inputs:

  • PR number: 1106
  • Commit SHA: 4212710056ee7c45b13de8c7b2aa2b97c1774cf0

Checks will be approved automatically on success.

@mgyucht mgyucht temporarily deployed to test-trigger-is January 3, 2025 09:56 — with GitHub Actions Inactive
@mgyucht mgyucht changed the title [Internal] Bump staticcheck [Internal] Bump staticcheck to 0.5.1 Jan 3, 2025
@mgyucht mgyucht changed the title [Internal] Bump staticcheck to 0.5.1 [Internal] Bump staticcheck to 0.5.1 and add go 1.23 test coverage Jan 3, 2025
Copy link
Contributor

@renaudhartert-db renaudhartert-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mgyucht mgyucht enabled auto-merge January 3, 2025 10:49
@mgyucht mgyucht added this pull request to the merge queue Jan 3, 2025
Merged via the queue into main with commit 28e1a69 Jan 3, 2025
18 checks passed
@mgyucht mgyucht deleted the bump-staticcheck branch January 3, 2025 10:53
parthban-db added a commit that referenced this pull request Jan 8, 2025
### Internal Changes

 * Bump staticcheck to 0.5.1 and add go 1.23 test coverage ([#1106](#1106)).
 * Bump x/net, x/crypto dependencies ([#1107](#1107)).
 * Create custom codeql.yml ([#1114](#1114)).
 * Decouple serving and oauth2 package ([#1110](#1110)).
 * Migrate workflows that need write access to use hosted runners ([#1112](#1112)).
 * Move package credentials in config ([#1115](#1115)).
 * Update Queries test ([#1104](#1104)).

### API Changes:

 * Added `NoCompute` field for [apps.CreateAppRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/apps#CreateAppRequest).
 * Added `HasMore` field for [jobs.BaseJob](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#BaseJob).
 * Added `HasMore` field for [jobs.BaseRun](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#BaseRun).
 * Added `PageToken` field for [jobs.GetJobRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#GetJobRequest).
 * Added `HasMore` and `NextPageToken` fields for [jobs.Job](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#Job).
 * Added `HasMore` field for [jobs.Run](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#Run).
 * Added `RunAs` field for [pipelines.CreatePipeline](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#CreatePipeline).
 * Added `RunAs` field for [pipelines.EditPipeline](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#EditPipeline).
 * Added `AuthorizationDetails` and `EndpointUrl` fields for [serving.DataPlaneInfo](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/serving#DataPlaneInfo).
 * Added .
 * Changed `Update` method for [a.AccountFederationPolicy](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#AccountFederationPolicyAPI) account-level service with new required argument order.
 * Changed `Update` method for [a.ServicePrincipalFederationPolicy](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#ServicePrincipalFederationPolicyAPI) account-level service with new required argument order.
 * Changed `UpdateMask` field for [oauth2.UpdateAccountFederationPolicyRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#UpdateAccountFederationPolicyRequest) to no longer be required.
 * Changed `UpdateMask` field for [oauth2.UpdateServicePrincipalFederationPolicyRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#UpdateServicePrincipalFederationPolicyRequest) to no longer be required.
 * Changed `DaysOfWeek` field for [pipelines.RestartWindow](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#RestartWindow) to type [pipelines.DayOfWeekList](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#DayOfWeekList).

OpenAPI SHA: 779817ed8d63031f5ea761fbd25ee84f38feec0d, Date: 2025-01-08
github-merge-queue bot pushed a commit that referenced this pull request Jan 13, 2025
### Internal Changes

* Bump staticcheck to 0.5.1 and add go 1.23 test coverage
([#1106](#1106)).
* Bump x/net, x/crypto dependencies
([#1107](#1107)).
* Create custom codeql.yml
([#1114](#1114)).
* Decouple serving and oauth2 package
([#1110](#1110)).
* Migrate workflows that need write access to use hosted runners
([#1112](#1112)).
* Move package credentials in config
([#1115](#1115)).
* Update Queries test
([#1104](#1104)).


### API Changes:

* Added `NoCompute` field for
[apps.CreateAppRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/apps#CreateAppRequest).
* Added `HasMore` field for
[jobs.BaseJob](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#BaseJob).
* Added `HasMore` field for
[jobs.BaseRun](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#BaseRun).
* Added `PageToken` field for
[jobs.GetJobRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#GetJobRequest).
* Added `HasMore` and `NextPageToken` fields for
[jobs.Job](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#Job).
* Added `HasMore` field for
[jobs.Run](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/jobs#Run).
* Added `RunAs` field for
[pipelines.CreatePipeline](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#CreatePipeline).
* Added `RunAs` field for
[pipelines.EditPipeline](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#EditPipeline).
* Added `AuthorizationDetails` and `EndpointUrl` fields for
[serving.DataPlaneInfo](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/serving#DataPlaneInfo).
* [Breaking] Changed `Update` method for
[a.AccountFederationPolicy](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#AccountFederationPolicyAPI)
account-level service with new required argument order.
* [Breaking] Changed `Update` method for
[a.ServicePrincipalFederationPolicy](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#ServicePrincipalFederationPolicyAPI)
account-level service with new required argument order.
* Changed `UpdateMask` field for
[oauth2.UpdateAccountFederationPolicyRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#UpdateAccountFederationPolicyRequest)
to no longer be required.
* Changed `UpdateMask` field for
[oauth2.UpdateServicePrincipalFederationPolicyRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#UpdateServicePrincipalFederationPolicyRequest)
to no longer be required.
* [Breaking] Changed `DaysOfWeek` field for
[pipelines.RestartWindow](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#RestartWindow)
to type
[pipelines.DayOfWeekList](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#DayOfWeekList).

OpenAPI SHA: 779817ed8d63031f5ea761fbd25ee84f38feec0d, Date: 2025-01-08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants