Simplify Go build tags
stefanb opened this issue ยท 3 comments
Currently there is a bunch of go build tags that have to be explicitly listed during build to get various functionalities that are not really depending on some 3rd party C library being installed on the system as they have all the needed implementation in referenced Go modules in pure Go.
Eg
rye/.github/workflows/build.yml
Line 63 in 832b291
lists a bunch of tags to build as much code as possible, but is easy to miss one or even check if all are included.
The list is hard to keep track of and can easily get out of sync and vastly different in other places:
rye/.github/workflows/build.yml
Line 78 in 832b291
Line 10 in 832b291
Line 37 in 832b291
https://github.com/Homebrew/homebrew-core/blob/45c5ae17a86523d65c9b1f1afb02c2de981157ea/Formula/r/ryelang.rb#L22-L23
IMO a better approach would be to include all functionality that only depends on Go code by default, and require tags to specifically enable features relying on external C libraries (ebitengine, webkit, raylib, gtk...).
making it easier to run & install also by
go run github.com/refaktor/rye@latest hello.rye
go install github.com/refaktor/rye@latest
without listing ANY tags.
Such unnecessary build tags could be removed or inverted (eg b_postgres
-> b_no_postgres
) to allow disabling them if this is needed (eg. if binary size is important).
Some tags could even be combined with default tags (cgo
, wasm
, linux
, windows
....), so that eg building wasm wouldn't require b_tiny
build flag (not sure if this is still needed).
I am not in favor of bundling all builtins in, but it would make things simpler, and available for new users, it would simplify build processes, automated and manual. Binary would then have "bateries included" which now they don't so they are less useful
And we just figured out that build flags don't get passed down to imports (I tested it once and falsely concluded that they do get passed). So if we build rye-ebitengine for example we can't pass -tags "b_sqlite" (again example) and rye would include it. So Rye including more bindings by default also solves problems around that, for now at least.
I will do this, I also made multiline repl with microliner work better (but now perfectly yet) so I would make another release with that commit.
Thank you for the proposal!
I made "allin" branch ... I enabled most modules and also some that weren't in ./build b_* tags now. Now it seems golint-ci is checking all these files and it reported a tons of issues. Which is great, for example "Error return value is not checked" as the builtins will be much more robust in an instant we solve this. But it will take some more time.
Ok. This was done now. Thanks!