Gomod pipe should include config env so it works with Go Workspaces and Go.mod replace directives #3426
Closed
3 tasks done
Labels
bug
Something isn't working
What happened?
goreleaser recommends using
goreleaser build
instead ofgo build
to keep a single source of truth which is useful in development environments.When working with a Go Workspace
go.work
,goreleaser build
needs to be combined withenv
GOWORK=off
but is not included when doinggo list -m
, see below.We have a goreleaser config with the following content:
In the step/pipe
loading go mod information
,goreleaser build
tries to rungo list -m
but it fails with the following error:That's because there are some
replace
directives in mygo.mod
file.This is not a problem outside goreleaser if we set the env variable
GOWORK=off
as inGOWORK=off go list -m -mod=vendor
.I already include
- GOWORK=off
as part of myenv
butinternal/pipe/gomod/gomod.go
is not using to callgo list -m
.How can we reproduce this?
replace
directive ingo.mod
go.work
)goreleaser build
goreleaser version
GoReleaser Check
Search
Code of Conduct
Additional context
I can send a PR to make sure we execute the external command with
ctx.Config.Env
The text was updated successfully, but these errors were encountered: