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

Check that go.mod is tidy in CI #2246

Merged
merged 2 commits into from
Jul 26, 2023
Merged

Check that go.mod is tidy in CI #2246

merged 2 commits into from
Jul 26, 2023

Conversation

moskyb
Copy link
Contributor

@moskyb moskyb commented Jul 26, 2023

i accidentally committed a go.mod with kr/pretty (which i often use for debugging) the other day. this PR makes it so that committing a non-tidy go.mod file will fail CI

@moskyb moskyb requested a review from a team July 26, 2023 00:15
Copy link
Contributor

@triarius triarius left a comment

Choose a reason for hiding this comment

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

Thank you! I do remember seeing it, but I forgot to check where it was used 🤦‍♂️

@moskyb moskyb enabled auto-merge July 26, 2023 00:18
@@ -8,4 +8,10 @@ if [[ $(gofmt -l ./ | head -c 1 | wc -c) != 0 ]]; then
exit 1
fi

if [[ $(go mod tidy -v 2> >(wc -c)) != 0 ]]; then # go mod tidy -v outputs to stderr for some reason
Copy link
Contributor

Choose a reason for hiding this comment

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

2> >(...) is fun!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sigh.

@moskyb moskyb merged commit c40373c into main Jul 26, 2023
1 check passed
@moskyb moskyb deleted the check-tidy-mod branch July 26, 2023 00:39
@DrJosh9000 DrJosh9000 added the quality of life Little improvements label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
quality of life Little improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants