this post was submitted on 02 Oct 2023
11 points (100.0% liked)
Golang
2217 readers
1 users here now
This is a community dedicated to the go programming language.
Useful Links:
Rules:
- Posts must be relevant to Go
- No NSFW content
- No hate speech, bigotry, etc
- Try to keep discussions on topic
- No spam of tools/companies/advertisements
- It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I'm a go n00b, but since the source code is available, I figured I'd look. TL;DR: it probably uses the shell's default globbing resolution to produce the file list.
The generate command iterates over the internal files, but I can't find exactly how GoFiles is populated.
You can probably learn what it's doing by running
go generate -n
orgo generate -x
, and I think you can also explicitly callgo generate
with a file pattern list, which would give you this control.Otherwise, I think you can include more than one magic comment in a single file, so if you have some dependant generators, these could be placed in the same file, sequentially, and you'd get the expected result.
Another alternative would be to try renaming the relevant files so that they sort the way you want them to run, lexicographically.
Good answers. I like these. I like the more than one command in a file, that will work. And yes, should have read the source!