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

'go mod tidy' removes entries related to the 'replace' instruction #28632

Closed
edwingeng opened this issue Nov 7, 2018 · 1 comment
Closed

Comments

@edwingeng
Copy link

edwingeng commented Nov 7, 2018

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

$ go version
1.11.2

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/gengbing/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/gengbing/Workspace/golang"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.2/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/gengbing/Workspace/tmp/gomodbug/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/z5/hn4wg1jd1pb5z2wl3x8y9ng40000gn/T/go-build233013232=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

mkdir gomodbug
cd gomodbug

cat << EOF > go.mod
module gomodbug

replace (
	github.com/mailru/easyjson => github.com/edwingeng/easyjson v0.0.0-20180909112517-9ee4e6945130
)
EOF

cat << EOF > stub.go
// +build untouchable

package gomodbug

import (
        _ "github.com/mailru/easyjson/easyjson"
)
EOF

cat << EOF > x.go
package gomodbug

type Foo struct {
	A int
	B string
}
EOF

go install github.com/mailru/easyjson/easyjson
easyjson -omit_empty -all x.go

echo
cat go.sum
echo

go mod tidy
cat go.sum

What did you expect to see?

'go mod tidy' should not change go.sum.

What did you see instead?

The 'cat go.sum' before 'go mod tidy' outputs:

github.com/edwingeng/easyjson v0.0.0-20180909112517-9ee4e6945130 h1:Ke1vi7wBhQv5uramtBfIIJ00crorqtiDAdcqzfJ3/B0=
github.com/edwingeng/easyjson v0.0.0-20180909112517-9ee4e6945130/go.mod h1:8Db6a8b4MGQg08ypk+IK5qQDIGPdVGGp+9RlA1FFRnE=

The 'cat go.sum' after 'go mod tidy' outputs:

github.com/edwingeng/easyjson v0.0.0-20180909112517-9ee4e6945130/go.mod h1:8Db6a8b4MGQg08ypk+IK5qQDIGPdVGGp+9RlA1FFRnE=
@myitcv
Copy link
Member

myitcv commented Nov 7, 2018

Dup of #27868

@myitcv myitcv closed this as completed Nov 7, 2018
@golang golang locked and limited conversation to collaborators Nov 7, 2019
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