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

cmd/go: go mod edit -module $module replaces empty string #28820

Closed
myitcv opened this issue Nov 15, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@myitcv
Copy link
Member

commented Nov 15, 2018

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

$ go version
go version devel +8fa789b689 Thu Nov 15 19:27:13 2018 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes - also reproduces with tip

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/myitcv/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/myitcv/gostuff"
GOPROXY=""
GORACE=""
GOROOT="/home/myitcv/dev/go"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/dev/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build662390965=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Here is a cmd/go testscript test that demonstrates the problem on tip:

env GO111MODULE=on

go mod init a.a/b/c
go mod edit -module x.x/y/z
cmpenv go.mod $WORK/go.mod.rename

-- $WORK/go.mod.init --
module a.a/b/c

go $goversion
-- $WORK/go.mod.rename --
module x.x/y/z

go $goversion

What did you expect to see?

Success

What did you see instead?

$ go test cmd/go -run=Script/mod_edit_me
go test proxy starting
go test proxy running at GOPROXY=http://127.0.0.1:45343/mod
--- FAIL: TestScript (0.00s)
    --- FAIL: TestScript/mod_edit_me (0.04s)
        script_test.go:182:
            > env GO111MODULE=on
            > go mod init a.a/b/c
            [stderr]
            go: creating new go.mod: module a.a/b/c
            > go mod edit -module x.x/y/z
            > cmpenv go.mod $WORK/go.mod.rename
            [diff -go.mod +$WORK/go.mod.rename]
            -module ""
            +module x.x/y/z

             go 1.12

            FAIL: testdata/script/mod_edit_me.txt:5: go.mod and $WORK/go.mod.rename differ

FAIL
FAIL    cmd/go  1.069s

@bcmills - I've marked this as 1.12... but please refile as you see fit.

@myitcv myitcv added this to the Go1.12 milestone Nov 15, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Nov 19, 2018

Change https://golang.org/cl/150277 mentions this issue: cmd/go/internal/modcmd: fix go mod edit -module replaces empty string

@oiooj

This comment has been minimized.

Copy link
Member

commented Nov 19, 2018

@myitcv Good catch.

@gopherbot gopherbot closed this in 8765e89 Dec 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.