All replaces are disallowed when using "go install" with a version number, regardless of what kind they are; see https://github.com/golang/go/issues/40276, specifically the sections about "replace".
I have a tool I'm currently rewriting that manages $GOBIN via a config file; I'm relying on "go install" where possible, but for modules that have replaces (for me, gopls at master), a workaround is to use a temporary module to pull everything in, copy over the replacements, then use a version-less "go install". On Wednesday, October 27, 2021 at 7:06:32 AM UTC-7 Sebastien Binet wrote: > hi there, > > I was updating instructions to install binaries for a package of mine, > with Go modules enabled. > > and I got: > > $> cd /tmp/dir > $> go install -v go-hep.org/x/hep/cmd/root2yoda@latest > go: downloading go-hep.org/x/hep v0.29.2 > go: go-hep.org/x/hep/cmd/root2yoda@latest (in go-hep.org/x/h...@v0.29.2 > <http://go-hep.org/x/hep@v0.29.2>): > The go.mod file for the module providing named packages contains one or > more replace directives. It must not contain directives that would cause > it to be interpreted differently than if it were the main module. > > why is that? > the replace directive is the following one: > replace github.com/apache/arrow/go/arrow => git.sr.ht/~sbinet/go-arrow > v0.1.1 > > (it's the only one.) > > I'd assume the error message above is for the cases where the replace > directive points at a local module, but shouldn't be displayed in this > case, right? > > I am using: > > $> go version > go version devel go1.18-cfb532158f Wed Oct 27 13:12:49 2021 +0000 > linux/amd64 > > cheers, > -s > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/d8cc2b23-7a57-4e4b-a751-d0c38329f546n%40googlegroups.com.