how to use replace directives in go.mod in dev but not prod

110 views
Skip to first unread message

Alex Mills

unread,
Sep 22, 2020, 1:52:05 AM9/22/20
to golang-nuts
I put this question on the golang issue tracker on github:

I am sure it's been answered before but hard to search for..anyone know what the right approach is? I like how node.js / NPM solve it using symlinks personally.

Paul Jolly

unread,
Sep 22, 2020, 2:04:29 AM9/22/20
to Alex Mills, golang-nuts
I just replied. I think that https://github.com/golang/go/issues/26640
covers this.
> --
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/92794ec1-ee89-4c98-820e-750b1db079ffn%40googlegroups.com.

Alex Mills

unread,
Sep 22, 2020, 2:37:17 AM9/22/20
to Paul Jolly, golang-nuts
i dont understand, is there a solution or just a proposal?

Paul Jolly

unread,
Sep 22, 2020, 4:21:55 AM9/22/20
to Alex Mills, golang-nuts
26640 is an open issue describing the same problem you're describing. Unfortunately because it remains open there is not yet a solution.

Denis Cheremisov

unread,
Sep 22, 2020, 5:00:50 AM9/22/20
to golang-nuts
CI probably is the anwser, made a utility based on golang.org/x/mod which parses go.mod and checks if replaces are there and exit with error state if they are.

вторник, 22 сентября 2020 г. в 11:21:55 UTC+3, Paul Jolly:

Paul Jolly

unread,
Sep 22, 2020, 5:19:50 AM9/22/20
to Denis Cheremisov, golang-nuts
> CI probably is the anwser, made a utility based on golang.org/x/mod which parses go.mod and checks if replaces are there and exit with error state if they are.

This isn't the problem discussed in 26640 at least. There, the issue
is that it is not currently possible to have a go.mod.local file
_outside_ of source control that augments the real go.mod.

Your suggestion is covered by the gorelease tool
(https://pkg.go.dev/golang.org/x/exp/cmd/gorelease)
Reply all
Reply to author
Forward
0 new messages