Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs bug: entirely unclear how to use replace directive in go.mod in production #39084

Closed
ORESoftware opened this issue May 15, 2020 · 2 comments

Comments

@ORESoftware
Copy link

ORESoftware commented May 15, 2020

What version of Go are you using (go version)?

go version go1.14 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/alex/Library/Caches/go-build"
GOENV="/Users/alex/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/alex/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/local/Cellar/go/1.14/libexec"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.14/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/alex/go/src/github.com/channelmeter/cp-go-api/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/qh/l8tr6tfd3gv7fmdg0b5z0p340000gn/T/go-build287184497=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Put a replace directive in a go.mod file

What did you expect to see?

I expect it to work in production without modifying the source files

What did you see instead?

It's unclear how to get it to work in production or how it works if the replace directive is left in the go.mod file. Are we expected to add/remove the replace directives manually, or will the replace directive be ignored if the replace directive path does not exist? It's unclear and the docs need to be clearer on this imo.

My goal is to use replace directives in go.mod and leave them there, and have them only be used in development but avoid the need to remove the lines from the go.mod file when pushing git commits to prod.

@bcmills
Copy link
Contributor

bcmills commented May 15, 2020

My goal is to use replace directives in go.mod and leave them there, and have them only be used in development but avoid the need to remove the lines from the go.mod file when pushing git commits to prod.

That is #26640.

@bcmills
Copy link
Contributor

bcmills commented May 15, 2020

Duplicate of #26640

@bcmills bcmills marked this as a duplicate of #26640 May 15, 2020
@bcmills bcmills closed this as completed May 15, 2020
@golang golang locked and limited conversation to collaborators May 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants