-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add checkstyle check and fix script for go deps #1491
Conversation
139d08e
to
82fa145
Compare
738a7b8
to
36b6592
Compare
da8fad7
to
a43fad3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall this looks really helpful, thanks for putting this together
.github/workflows/checkstyle.yaml
Outdated
- name: Setup go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.17.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you want to leave a comment in WORKSPACE that points to this file and mentions these versions should be kept in sync?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,79 @@ | |||
#!/bin/bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add an option to ./buildfix.sh that does this so we continue to have one script that will "ready" your build for review?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, can now use ./buildfix.sh --go_deps
flag to additionally invoke this script as part of ./buildfix.sh
Also added an --all
flag that is the same as --gazelle --go_deps
.
FYI, verified that this works on Mac. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Thanks so much for doing this; when go.mod
got out-of-date, gopls
would give up and my IDE functionality would stop working until I went and ran go mod tidy again, so this is super helpful.
@@ -5,26 +5,27 @@ go 1.17 | |||
replace ( | |||
github.com/firecracker-microvm/firecracker-go-sdk => github.com/tylerwilliams/firecracker-go-sdk v0.22.1 | |||
github.com/go-redsync/redsync/v4 v4.4.1 => github.com/bduffany/redsync/v4 v4.4.1-minimal | |||
github.com/lni/dragonboat/v3 => github.com/tylerwilliams/dragonboat/v3 v3.3.4-rc2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thankyou!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR adds a check to enforce the following:
go mod tidy -e
would produce no diffs togo.mod
orgo.sum
go.mod
has exactly 2require()
blocks, one for direct imports and one for indirect imports. See cmd/go: lazy modules: separate section for indirect imports golang/go#45965deps.bzl
via Gazelle would produce no diffsProvides a script to automatically fix most errors detected, or provide instructions on how to manually fix (
tools/fix_go_deps.sh
)Note: the
-e
flag togo mod tidy
lets us avoid the need to add the generated protos to the repo before runninggo mod tidy
. This flag is not supported in Go 1.15 (the version currently used in GH actions), so this PR also adds a step to upgrade the Go version to v1.17.Example failing run (before running
tools/fix_go_deps.sh
in this PR): https://github.com/buildbuddy-io/buildbuddy/runs/4960976363?check_suite_focus=true -- the diff is huge here becausego.mod
is particularly whacky these days, but the diff should be much smaller in the future.Version bump: Patch