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

Update cockroach-go module version #146

Merged
merged 1 commit into from Jun 8, 2022

Conversation

rimadeodhar
Copy link
Contributor

The new cockroach-go module adds a tenant scope argument
while generating client certificates for tenant servers
within the cockroach go repo. We need this new change in
order for the tests with example-orms to work correctly
with the upcoming changes for tenant scoped client certificates.
Without this change, the tenant tests will fail as the client
certificates generated through the cockroach-go modules will be
unable to authenticate correctly with the tenant server.

@rimadeodhar rimadeodhar requested a review from rafiss June 7, 2022 20:53
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

i think the error might be resolved by go mod tidy but i'm not sure

@rimadeodhar
Copy link
Contributor Author

Thanks Rafi, go mod tidy does seem to update the necessary dependency. Will update the PR with the changes.

@rafiss
Copy link
Contributor

rafiss commented Jun 7, 2022

I've never seen this lint failure before. something must have changed in the CI environment, since we haven't updated this repo in a while

  level=warning msg="[runner] Can't run linter goanalysis_metalinter: S1006: failed prerequisites: [(inspect@github.com/cockroachdb/examples-orms/go/gopg, isgenerated@github.com/cockroachdb/examples-orms/go/gopg): analysis skipped: errors in package: [/home/runner/work/examples-orms/examples-orms/go/gopg/main.go:4:2: could not import flag (/opt/hostedtoolcache/go/1.18.2/x64/src/flag/flag.go:71:2: could not import errors (/opt/hostedtoolcache/go/1.18.2/x64/src/errors/wrap.go:8:2: could not import internal/reflectlite (/opt/hostedtoolcache/go/1.18.2/x64/src/internal/reflectlite/swapper.go:8:2: could not import internal/goarch (-: could not load export data: cannot import \"internal/goarch\" (unknown iexport format version 2), export data is newer version - update tool)))) /home/runner/work/examples-orms/examples-orms/go/gopg/main.go:5:2: could not import fmt (/opt/hostedtoolcache/go/1.18.2/x64/src/fmt/errors.go:7:8: could not import errors (/opt/hostedtoolcache/go/1.18.2/x64/src/errors/wrap.go:8:2: could not import internal/reflectlite (/opt/hostedtoolcache/go/1.18.2/x64/src/internal/reflectlite/swapper.go:8:2: could not import internal/goarch (-: could not load export data: cannot import \"internal/goarch\" (unknown iexport format version 2), export data is newer version - update tool)))) /home/runner/work/examples-orms/examples-orms/go/gopg/main.go:6:2: could not import log (/opt/hostedtoolcache/go/1.18.2/x64/src/log/log.go:18:2: could not import fmt (/opt/hostedtoolcache/go/1.18.2/x64/src/fmt/errors.go:7:8: could not import errors (/opt/hostedtoolcache/go/1.18.2/x64/src/errors/wrap.go:8:2: could not import internal/reflectlite (/opt/hostedtoolcache/go/1.18.2/x64/src/internal/reflectlite/swapper.go:8:2: could not import internal/goarch (-: could not load export data: cannot import \"internal/goarch\" (unknown iexport format version 2), export data is newer version - update tool))))) /home/runner/work/examples-orms/examples-orms/go/gopg/main.go:7:2: could not import net/http (/opt/hostedtoolcache/go/1.18.2/x64/src/net/http/client.go:13:2: could not import context (/opt/hostedtoolcache/go/1.18.2/x64/src/context/context.go:51:2: could not import errors (/opt/hostedtoolcache/go/1.18.2/x64/src/errors/wrap.go:8:2: could not import internal/reflectlite (/opt/hostedtoolcache/go/1.18.2/x64/src/internal/reflectlite/swapper.go:8:2: could not import internal/goarch (-: could not load export data: cannot import \"internal/goarch\" (unknown iexport format version 2), export data is newer version - update tool))))) /home/runner/work/examples-orms/examples-orms/go/gopg/main.go:10:2: could not import github.com/go-pg/pg/v10 (/home/runner/go/pkg/mod/github.com/go-pg/pg/v10@v10.9.0/base.go:4:2: could not import context (/opt/hostedtoolcache/go/1.18.2/x64/src/context/context.go:51:2: could not import errors (/opt/hostedtoolcache/go/1.18.2/x64/src/errors/wrap.go:8:2: could not import internal/reflectlite (/opt/hostedtoolcache/go/1.18.2/x64/src/internal/reflectlite/swapper.go:8:2: could not import internal/goarch (-: could not load export data: cannot import \"internal/goarch\" (unknown iexport format version 2), export data is newer version - update tool))))) /home/runner/work/examples-orms/examples-orms/go/gopg/main.go:11:2: could not import github.com/go-pg/pg/v10/orm (/home/runner/go/pkg/mod/github.com/go-pg/pg/v10@v10.9.0/orm/composite.go:4:2: could not import fmt (/opt/hostedtoolcache/go/1.18.2/x64/src/fmt/errors.go:7:8: could not import errors (/opt/hostedtoolcache/go/1.18.2/x64/src/errors/wrap.go:8:2: could not import internal/reflectlite (/opt/hostedtoolcache/go/1.18.2/x64/src/internal/reflectlite/swapper.go:8:2: could not import internal/goarch (-: could not load export data: cannot import \"internal/goarch\" (unknown iexport format version 2), export data is newer version - update tool))))) /home/runner/work/examples-orms/examples-orms/go/gopg/main.go:12:2: could not import github.com/julienschmidt/httprouter (/home/runner/go/pkg/mod/github.com/julienschmidt/httprouter@v1.1.0/router.go:80:2: could not import net/http (/opt/hostedtoolcache/go/1.18.2/x64/src/net/http/client.go:13:2: could not import context (/opt/hostedtoolcache/go/1.18.2/x64/src/context/context.go:51:2: could not import errors (/opt/hostedtoolcache/go/1.18.2/x64/src/errors/wrap.go:8:2: could not import internal/reflectlite (/opt/hostedtoolcache/go/1.18.2/x64/src/internal/reflectlite/swapper.go:8:2: could not import internal/goarch (-: could not load export data: cannot import \"internal/goarch\" (unknown iexport format version 2), export data is newer version - update tool)))))) /home/runner/work/examples-orms/examples-orms/go/gopg/server.go:4:2: could not import encoding/json (/opt/hostedtoolcache/go/1.18.2/x64/src/encoding/json/decode.go:11:2: could not import encoding (-: could not load export data: cannot import \"encoding\" (unknown iexport format version 2), export data is newer version - update tool)) /home/runner/work/examples-orms/examples-orms/go/gopg/server.go:7:2: could not import strconv (/opt/hostedtoolcache/go/1.18.2/x64/src/strconv/atof.go:13:8: could not import math (/opt/hostedtoolcache/go/1.18.2/x64/src/math/exp_amd64.go:9:8: could not import internal/cpu (-: could not load export data: cannot import \"internal/cpu\" (unknown iexport format version 2), export data is newer version - update tool))) /home/runner/work/examples-orms/examples-orms/go/gopg/main.go:33:28: undeclared name: pg /home/runner/work/examples-orms/examples-orms/go/gopg/server.go:16:6: undeclared name: pg /home/runner/work/examples-orms/examples-orms/go/gopg/server.go:20:20: undeclared name: pg /home/runner/work/examples-orms/examples-orms/go/gopg/main.go:34:14: undeclared name: pg /home/runner/work/examples-orms/examples-orms/go/gopg/main.go:38:8: undeclared name: pg /home/runner/work/examples-orms/examples-orms/go/gopg/server.go:388:7: undeclared name: pg /home/runner/work/examples-orms/examples-orms/go/gopg/main.go:10:2: \"github.com/go-pg/pg/v10\" imported but not used /home/runner/work/examples-orms/examples-orms/go/gopg/server.go:10:2: \"github.com/go-pg/pg/v10\" imported but not used]]"

only the last few things seem actionable:

/home/runner/work/examples-orms/examples-orms/go/gopg/main.go:33:28: undeclared name: pg 
/home/runner/work/examples-orms/examples-orms/go/gopg/server.go:16:6: undeclared name: pg 
/home/runner/work/examples-orms/examples-orms/go/gopg/server.go:20:20: undeclared name: pg 
/home/runner/work/examples-orms/examples-orms/go/gopg/main.go:34:14: undeclared name: pg 
/home/runner/work/examples-orms/examples-orms/go/gopg/main.go:38:8: undeclared name: pg 
/home/runner/work/examples-orms/examples-orms/go/gopg/server.go:388:7: undeclared name: pg 
/home/runner/work/examples-orms/examples-orms/go/gopg/main.go:10:2: \"github.com/go-pg/pg/v10\" imported but not used 
/home/runner/work/examples-orms/examples-orms/go/gopg/server.go:10:2: \"github.com/go-pg/pg/v10\" imported but not used

edit: nvm, i don't see why the linter is complaining. those lines look fine to me.

go.mod Outdated
@@ -3,11 +3,12 @@ module github.com/cockroachdb/examples-orms
go 1.13
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps try updating this to go 1.17?

@rafiss
Copy link
Contributor

rafiss commented Jun 7, 2022

Ah, one more shot in the dark! The file in .github/workflows/golangci-lint.yml has a golangci-lint version of v1.29. That seems pretty old. Perhaps try v1.46.2

@rimadeodhar
Copy link
Contributor Author

Ok will try. Any way to run this locally? Will be easier to iterate on this.

@rafiss
Copy link
Contributor

rafiss commented Jun 8, 2022

The issue is in the Github CI environment, and I don't know how to run that locally. Maybe Github has instructions for it in their docs.

@rimadeodhar
Copy link
Contributor Author

I see. Okay, let me dig into this today.

@@ -21,4 +21,4 @@ jobs:
uses: golangci/golangci-lint-action@v2
Copy link
Contributor

Choose a reason for hiding this comment

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

I found this repo: https://github.com/golangci/golangci-lint-action

Looks like they have a @v3 now... They have a thing in their README saying how to configure it: https://github.com/golangci/golangci-lint-action#compatibility

(In case you couldn't tell, I have never worked with this Github CI configuration either, so I'm suggesting things ad-hoc)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the help. This is new to me as well so let me read up on it a little. Btw, this test isn't marked as required. Does that mean it would be ok to merge this PR and fix it in a follow up? Ideally, I would like to fix it before merge but wanted to know what my options are in case debugging this takes too long.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, nice catch. in that case, yes i'll approve this and if you can't make any further progress on the linter feel free to merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interestingly its running a go version of 1.18 even though go mod specifies it as 1.17

 GOVERSION="go1.18.2"

I think I need to understand the setup better.

The new cockroach-go module adds a tenant scope argument
while generating client certificates for tenant servers
within the cockroach go repo. We need this new change in
order for the tests with example-orms to work correctly
with the upcoming changes for tenant scoped client certificates.
Without this change, the tenant tests will fail as the client
certificates generated through the cockroach-go modules will be
unable to authenticate correctly with the tenant server.
@rimadeodhar
Copy link
Contributor Author

Ta-da, managed to get it working, lol after playing around with it locally. Turns out needed a go mod tidy, update the actions/checkout and golangci/golangci-lint-action to v3 and set the go version in the config file explicitly to 1.17. Apparently 1.18 is still causing trouble in general based on some threads I found: golangci/golangci-lint#825.

@rafiss
Copy link
Contributor

rafiss commented Jun 8, 2022

amazing! thank you for getting into the weeds on it

Copy link
Contributor Author

@rimadeodhar rimadeodhar left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 3 files reviewed, 2 unresolved discussions (waiting on @rafiss)


go.mod line 3 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

perhaps try updating this to go 1.17?

Done.

@rimadeodhar rimadeodhar merged commit f56afa2 into cockroachdb:master Jun 8, 2022
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.

None yet

3 participants