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

Add checkstyle check and fix script for go deps #1491

Merged
merged 10 commits into from
Jan 28, 2022
Merged

Add checkstyle check and fix script for go deps #1491

merged 10 commits into from
Jan 28, 2022

Conversation

bduffany
Copy link
Member

@bduffany bduffany commented Jan 27, 2022

This PR adds a check to enforce the following:

Provides 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 to go mod tidy lets us avoid the need to add the generated protos to the repo before running go 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 because go.mod is particularly whacky these days, but the diff should be much smaller in the future.


Version bump: Patch

@bduffany bduffany changed the title [WIP] Add CI check and fix script for go deps [WIP] Add checkstyle check and fix script for go deps Jan 27, 2022
@bduffany bduffany force-pushed the tidyup branch 9 times, most recently from 139d08e to 82fa145 Compare January 27, 2022 02:52
@bduffany bduffany changed the title [WIP] Add checkstyle check and fix script for go deps Add checkstyle check and fix script for go deps Jan 27, 2022
@bduffany bduffany force-pushed the tidyup branch 2 times, most recently from 738a7b8 to 36b6592 Compare January 27, 2022 03:13
@bduffany bduffany force-pushed the tidyup branch 3 times, most recently from da8fad7 to a43fad3 Compare January 27, 2022 03:29
Copy link
Member

@vadimberezniker vadimberezniker left a comment

Choose a reason for hiding this comment

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

nice :)

Copy link
Member

@tylerwilliams tylerwilliams left a 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

- name: Setup go
uses: actions/setup-go@v2
with:
go-version: "1.17.2"
Copy link
Member

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?

Copy link
Member Author

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
Copy link
Member

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?

Copy link
Member Author

@bduffany bduffany Jan 28, 2022

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.

@bduffany
Copy link
Member Author

FYI, verified that this works on Mac.

Copy link
Contributor

@tempoz tempoz left a 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
Copy link
Member

Choose a reason for hiding this comment

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

thankyou!

Copy link
Member

@tylerwilliams tylerwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

@bduffany bduffany merged commit e721cf2 into master Jan 28, 2022
@bduffany bduffany deleted the tidyup branch January 28, 2022 17:40
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

4 participants