Skip to content

Commit

Permalink
mod: wrong require when migrate from dep with source config
Browse files Browse the repository at this point in the history
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`

Signed-off-by: Chang Liu <[email protected]>
  • Loading branch information
liuchang0812 committed Jul 29, 2019
1 parent 9195948 commit 5774b90
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cmd/go/internal/modconv/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ func ConvertLegacyConfig(f *modfile.File, file string, data []byte) error {
if err != nil {
return fmt.Errorf("add replace: %v", err)
}
f.AddNewRequire(re.Old.Path, need[path], false)
} else {
f.AddNewRequire(path, need[path], false)
}
f.AddNewRequire(path, need[path], false)
}

f.Cleanup()
Expand Down

0 comments on commit 5774b90

Please sign in to comment.