Conversation
Codecov Report
@@ Coverage Diff @@
## master #2928 +/- ##
=======================================
Coverage 98.17% 98.17%
=======================================
Files 143 143
Lines 12597 12597
=======================================
Hits 12367 12367
Misses 156 156
Partials 74 74 |
# Conflicts: # .github/workflows/linter.yml
|
Would it bother/upset you if I asked you to rename all the bash scripts in the "scripts" directory to have a ".sh" suffix? |
|
I can go either way on script names. I noticed .gitignore has a |
Ah, yes, please leave the |
gmlewis
left a comment
There was a problem hiding this comment.
This looks great, @WillAbides !
Thank you so much for doing this! I think it will help users and maintainers alike.
While you are touching parts of CONTRIBUTING.md, I hope you don't mind if I ask you to tweak a couple things that aren't actually related to your PR? That would be awesome.
Co-authored-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
Co-authored-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
gmlewis
left a comment
There was a problem hiding this comment.
Excellent, @WillAbides - thank you!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
|
Thank you, @valbeat ! @WillAbides - do you want to change "scripts" back to your original "script" before I merge? |
|
Thanks. I'll update it in the morning. |
|
@gmlewis It's ready to go now |
gmlewis
left a comment
There was a problem hiding this comment.
Thank you, @WillAbides !
LGTM.
Merging.
closes #2927
Scripts
This adds the four scripts proposed in #2927.
The scripts all follow the basic pattern of iterating over the go modules in the repo and running the appropriate commands in each directory. Because of this, there is some duplicate code. I chose to keep it this way because deduping it added complexity, and I wanted to keep these scripts as simple as possible to understand.
The only dependencies for these scripts are git and a posix shell.
script/fmt.shis the simplest one. It runsgo fmt ./...in each module directory.script/generate.shrunsgo generate ./...andgo mod tidy -compat '1.17'in each module directory. It also has a--checkflag which causes it to run on a temporary git worktree and fail if any new diff is created.script/lint.shrunsgolangci-lint runon each module then runsscript/generate.sh --check. It installs golangci-lint inbin/if needed.script/test.shrunsgo testin each module directory. If arguments are provided, those are used as arguments forgo test, otherwise it uses the default arguments-race -covermode atomic ./...script/lint.shandscript/test.shskip the module inexample/newreposecretwithlibsodiumbecause it cannot compile unless libsodium is available.CONTRIBUTING.md
Workflow changes
linter.yml
script/lint.shinstead of using the golangci-lint action.script/lint.shiterates over modules, I was able to remove the run matrix. We now only run one lint job instead of four.script/lint.shvalidatesgo generate.tests.yml
script/test.shinstead of runninggo testmultiple times in separate steps.go generatenow that it is checked in lint.Misc changes
Running
script/test.shexposed an issue where theexamplesmodule won't compile on Windows becausesyscall.Stdinis typed differently on Windows. I resolved this by replacingsyscall.Stdinwithint(os.Stdin.Fd())