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

Use replace directives in go.mod in development only #41546

Closed
ORESoftware opened this issue Sep 22, 2020 · 2 comments
Closed

Use replace directives in go.mod in development only #41546

ORESoftware opened this issue Sep 22, 2020 · 2 comments

Comments

@ORESoftware
Copy link

@ORESoftware ORESoftware commented Sep 22, 2020

Problem

My go.mod file has:

replace github.com/channelmeter/send-to-rollbar-via-stdin => ../send-to-rollbar-via-stdin

this replace directive works in dev but not in prod. How can I ignore certain replace directives when running go install in prod? I want the replace directive to be ignored.

The error shows up as follows:


Step 27/43 : RUN go install -v  2>&1
 ---> Running in 1d1717578978
go: github.com/channelmeter/send-to-rollbar-via-stdin@v0.0.0-20200922010219-c39f088cd56d: parsing ../send-to-rollbar-via-stdin/go.mod: open /go/src/github.com/channelmeter/send-to-rollbar-via-stdin/go.mod: no such file or directory
The command '/bin/sh -c go install -v  2>&1' returned a non-zero code: 1

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

go version go1.14.4 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

Ubuntu Linux 64 bit

go env Output

AR="ar"
CC="gcc"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_ENABLED="1"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
CXX="g++"
GCCGO="gccgo"
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/alex/.cache/go-build"
GOENV="/home/alex/.config/go/env"
GOEXE=""
GOFLAGS=""
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build016167139=/tmp/go-build -gno-record-gcc-switches"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMOD="/home/alex/go/src/github.com/channelmeter/cp-go-api/go.mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/alex/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/home/alex/.local/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/home/alex/.local/go/pkg/tool/linux_amd64"
PKG_CONFIG="pkg-config"

What did you do?

I ran go install in prod, which breaks since prod fs in a docker container is not like my local fs.

@myitcv
Copy link
Member

@myitcv myitcv commented Sep 22, 2020

I think this is entirely covered by #26640.

@mvdan
Copy link
Member

@mvdan mvdan commented Sep 22, 2020

Closing as a dup, since you gave a thumbs up.

@mvdan mvdan closed this Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.