-
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
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0a881d1
Add CI check and fix script for go deps
bduffany 002a02e
Fix go deps
bduffany e24bcaf
Check for at most 2 require blocks
bduffany 6cd25ec
Check for direct then indirect imports
bduffany 9563d30
Address PR feedback
bduffany cc5a07e
Reference buildfix command for all outputs
bduffany 290f5e6
Merge branch 'master' into tidyup
bduffany dd8ad17
Fix deps again
bduffany 91aaa6f
Improve flag name
bduffany 12ba442
Add more sync comments
bduffany File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,11 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Setup go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.17.2" # Keep in sync with WORKSPACE | ||
|
||
- name: gofmt | ||
run: | | ||
gofmt -d . > gofmt-diff.txt || true | ||
|
@@ -25,18 +30,27 @@ jobs: | |
|
||
- name: buildifier | ||
run: | | ||
go get -u github.com/bazelbuild/buildtools/buildifier | ||
go install github.com/bazelbuild/buildtools/buildifier@3.4.0 | ||
"$(go env GOPATH)/bin/buildifier" -d -r . > buildifier-diff.txt || true | ||
echo "buildifier diff:" | ||
cat buildifier-diff.txt | ||
|
||
- name: gazelle | ||
# Keep Gazelle version in sync with WORKSPACE | ||
run: | | ||
go get github.com/bazelbuild/bazel-gazelle/cmd/gazelle | ||
go install github.com/bazelbuild/bazel-gazelle/cmd/gazelle@v0.23.0 | ||
"$(go env GOPATH)/bin/gazelle" -mode diff > gazelle-diff.txt || true | ||
echo "gazelle diff:" | ||
cat gazelle-diff.txt | ||
|
||
- name: go deps | ||
# Keep Gazelle version in sync with WORKSPACE | ||
run: | | ||
go install github.com/bazelbuild/bazel-gazelle/cmd/[email protected] | ||
GAZELLE_PATH="$(go env GOPATH)/bin/gazelle" tools/fix_go_deps.sh --diff &> go-deps-diff.txt || true | ||
echo "go deps diff:" | ||
cat go-deps-diff.txt | ||
|
||
- name: clang-format | ||
run: | | ||
git ls-files | grep '\.proto$' | xargs --no-run-if-empty -d'\n' clang-format -i --style=Google --dry-run &> clang-format-errors.txt || true | ||
|
@@ -58,18 +72,21 @@ jobs: | |
|
||
- name: Check | ||
run: | | ||
echo "===== gofmt diff =====" | ||
echo "===== gofmt diff (fix with ./buildfix.sh) =====" | ||
cat gofmt-diff.txt | ||
echo "===== buildifier diff =====" | ||
echo "===== buildifier diff (fix with ./buildfix.sh) =====" | ||
cat buildifier-diff.txt | ||
echo "===== gazelle diff =====" | ||
echo "===== gazelle diff (fix with ./buildfix.sh --gazelle) =====" | ||
cat gazelle-diff.txt | ||
echo "===== clang-format errors =====" | ||
echo "===== go deps diff (fix with ./buildfix.sh --go_deps) =====" | ||
cat go-deps-diff.txt | ||
echo "===== clang-format errors (fix with ./buildfix.sh) =====" | ||
cat clang-format-errors.txt | ||
echo "===== prettier errors =====" | ||
echo "===== prettier errors (fix with ./buildfix.sh) =====" | ||
cat prettier-errors.txt | ||
|
||
if [ -s gazelle-diff.txt ]; then exit 1; fi | ||
if [ -s go-deps-diff.txt ]; then exit 1; fi | ||
if [ -s gofmt-diff.txt ]; then exit 1; fi | ||
if [ -s buildifier-diff.txt ]; then exit 1; fi | ||
if [ -s clang-format-errors.txt ]; then exit 1; fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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!