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: conversion from legacy dependency managers puts replacement module path in require section #33406

Open
liuchang0812 opened this issue Aug 1, 2019 · 5 comments

Comments

@liuchang0812
Copy link

@liuchang0812 liuchang0812 commented Aug 1, 2019

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

$ go version
go version go1.12.6 linux/amd64

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="/home/liuchang/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/liuchang/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/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-build510154135=/tmp/go-build -gno-record-gcc-switches"

What did you do?

run go mod init with a dep project that contains source config.

What did you expect to see?

go.mod should put module's old path in require section.

What did you see instead?

go.mod put module's new path in require section.

liuchang0812 added a commit to liuchang0812/go that referenced this issue Aug 1, 2019
This change modifies Go to generate correct go.mod file.
Currently go-mod puts wrong module path in requires when
Gopkg.toml contains source config. for example, there is
a constraint declaration in Gopkg.toml as following:

[[constraint]]
  name = "github.com/minio/minio-go"
  revision = "0415038e6086735b8c917d7fdb2ca93f07d7fb60"
  source = "https://github.com/liuchang0812/minio-go"

go-mod puts `github.com/liuchang0812/minio-go` in requires.
but, it should be `github.com/minio/minio-go`

Fixes: golang#33406
@bcmills bcmills changed the title cmd/go: go mod init command puts replace's new module path in require section cmd/go: conversion from Dep puts replacement module path in require section Aug 2, 2019
@bcmills bcmills added this to the Go1.14 milestone Aug 2, 2019
@bcmills bcmills added the help wanted label Aug 5, 2019
@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Sep 16, 2019

@liuchang0812, is this still an issue?

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Sep 16, 2019

Never mind, spotted an issue in src/cmd/go/testdata/script/mod_init_dep.txt that reproduces it.

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Sep 16, 2019

@liuchang0812

This comment has been minimized.

Copy link
Author

@liuchang0812 liuchang0812 commented Sep 17, 2019

@bcmills I added a test case in src/cmd/go/internal/modconv/convert_test.go, see #33343

@bcmills bcmills changed the title cmd/go: conversion from Dep puts replacement module path in require section cmd/go: conversion from legacy dependency managers puts replacement module path in require section Sep 26, 2019
@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Sep 26, 2019

@liuchang0812, I don't think we even need a new test case. We need to fix the existing mod_init_dep test case as described in CL 126915.

@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.