You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
As a way of minimising the tooling required on developer machines, we like to download a Go tarball locally on a per-project basis and use the untarred binary and GOROOT for all development work in that project. That means for a given project GOROOT is project/_bin/go-$GOVERSION/go and the Go binary can be found inside that GOROOT at project/_bin/go-$GOVERSION/go/bin/go.
We'd like to use the same flags for all builds of our projects, and we want to define those flags in goreleaser.yaml
We can set the GOROOT for a goreleaser build using environment variables and that works as expected.
However, it seems environment variable expansion doesn't work inside the goBinary field and there doesn't appear to be any other way to set this field, so we end up having to hack around the problem.
Our hack currently is to create a copy of _bin/go-1.21.4/go/bin/go to _bin/go-vendored which we update whenever our GO_VERSION variable changes. That means we have gobinary: _bin/go-vendored set in goreleaser.yaml, which in turn means that the only way to use goreleaser in this project is through the Makefile.
If we were able to set GOROOT and it were to be searched for the bin/go path, people would be able to use their system go for development if desired while our CI would still use our vendored go.
Describe the solution you'd like
We only need one version of Go per goreleaser.yaml, but others might want a different setup. We would be fine with any solution which lets us have more flexibility around customising the gobinary field. Some examples:
Some global env var we can set when we run goreleaser (e.g. GORELEASER_GO_BINARY=_bin/go-1.21.4/bin/go GOROOT=_bin/go-1.21.4/go goreleaser build ...)
Environment variable expansion inside the gobinary field, e.g.:
(My personal favourite, I think): Some flag which tells goreleaser to look for the go binary in GOROOT rather than defaulting to go, e.g.:
goBinaryFromGoRoot: true # there'd probably be a better nameenv:
- GOROOT=.../project/_bin/go-1.21.4/go # since .../project/_bin/go-1.21.4/go/bin/go exists, we use that
This change might not need a flag, although I suppose it could be breaking for users who set GOROOT today but who for some reason don't have bin/go in their GOROOT.
Describe alternatives you've considered
I can't really see an alternative in our use case but I'd be interested in discussing it!
Search
I did search for other open and closed issues before opening this
Is your feature request related to a problem? Please describe.
As a way of minimising the tooling required on developer machines, we like to download a Go tarball locally on a per-project basis and use the untarred binary and GOROOT for all development work in that project. That means for a given project GOROOT is
project/_bin/go-$GOVERSION/go
and the Go binary can be found inside that GOROOT atproject/_bin/go-$GOVERSION/go/bin/go
.We'd like to use the same flags for all builds of our projects, and we want to define those flags in
goreleaser.yaml
We can set the GOROOT for a goreleaser build using environment variables and that works as expected.
However, it seems environment variable expansion doesn't work inside the
goBinary
field and there doesn't appear to be any other way to set this field, so we end up having to hack around the problem.Our hack currently is to create a copy of
_bin/go-1.21.4/go/bin/go
to_bin/go-vendored
which we update whenever ourGO_VERSION
variable changes. That means we havegobinary: _bin/go-vendored
set ingoreleaser.yaml
, which in turn means that the only way to use goreleaser in this project is through the Makefile.If we were able to set GOROOT and it were to be searched for the
bin/go
path, people would be able to use their system go for development if desired while our CI would still use our vendored go.Describe the solution you'd like
We only need one version of Go per
goreleaser.yaml
, but others might want a different setup. We would be fine with any solution which lets us have more flexibility around customising thegobinary
field. Some examples:Some global env var we can set when we run goreleaser (e.g.
GORELEASER_GO_BINARY=_bin/go-1.21.4/bin/go GOROOT=_bin/go-1.21.4/go goreleaser build ...
)Environment variable expansion inside the
gobinary
field, e.g.:(My personal favourite, I think): Some flag which tells goreleaser to look for the go binary in GOROOT rather than defaulting to
go
, e.g.:This change might not need a flag, although I suppose it could be breaking for users who set GOROOT today but who for some reason don't have
bin/go
in their GOROOT.Describe alternatives you've considered
I can't really see an alternative in our use case but I'd be interested in discussing it!
Search
Supporter
Code of Conduct
Additional context
No response
The text was updated successfully, but these errors were encountered: