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 init migration from dep does not honnor source directive #28503

Closed
sylr opened this issue Oct 31, 2018 · 1 comment
Closed

cmd/go: go mod init migration from dep does not honnor source directive #28503

sylr opened this issue Oct 31, 2018 · 1 comment

Comments

@sylr
Copy link

sylr commented Oct 31, 2018

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

go version go1.11.1 linux/amd64

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/sylvain/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/sylvain/gopath"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go-1.11"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.11/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-build591024377=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I've a go project currently using dep which has package constraints using the source directive that allows to use forks of packages without changing their names.

Gopkg.toml :

[[constraint]]
  name = "github.com/prometheus/client_golang"
  revision = "3347d9b107629a2e31c401594dfa45e1a894d16c"
  source = "github.com/sylr/prometheus-client-golang"

[[constraint]]
  name = "github.com/Azure/azure-sdk-for-go"
  revision = "182e361c74920501df5b492a982002fcd49b5a29"
  source = "https://github.com/sylr/azure-sdk-for-go.git"

Gopkg.lock:

[[projects]]
  name = "github.com/prometheus/client_golang"
  packages = [
    "prometheus",
    "prometheus/internal",
    "prometheus/promhttp"
  ]
  revision = "3347d9b107629a2e31c401594dfa45e1a894d16c"
  source = "github.com/sylr/prometheus-client-golang"

[[projects]]
  name = "github.com/Azure/azure-sdk-for-go"
  packages = [
    "services/batch/2018-08-01.7.0/batch",
    "services/batch/mgmt/2017-09-01/batch",
    "services/preview/subscription/mgmt/2018-03-01-preview/subscription",
    "version"
  ]
  revision = "182e361c74920501df5b492a982002fcd49b5a29"
  source = "https://github.com/sylr/azure-sdk-for-go.git"

I tried to use go modules init to migrate from dep to modules but it failed on the packages mentioned above :

sylvain@ubuntu-1604-dev:~/gopath/src/github.com/sylr/prometheus-azure-exporter[master]$ GO111MODULE=on go mod init
go: creating new go.mod: module github.com/sylr/prometheus-azure-exporter
go: copying requirements from Gopkg.lock
go: converting Gopkg.lock: stat github.com/prometheus/client_golang@3347d9b107629a2e31c401594dfa45e1a894d16c: unknown revision 3347d9b107629a2e31c401594dfa45e1a894d16c
go: converting Gopkg.lock: stat github.com/Azure/azure-sdk-for-go@182e361c74920501df5b492a982002fcd49b5a29: unknown revision 182e361c74920501df5b492a982002fcd49b5a29

You can reproduce using sylr/prometheus-azure-exporter@bab5c8a

What did you expect to see?

I expected go modules init to honnor the source directive of Gopkg.lock files.

Cheers

@myitcv
Copy link
Member

myitcv commented Oct 31, 2018

Appears to be a duplicate of #24087

@myitcv myitcv closed this as completed Oct 31, 2018
@myitcv myitcv added the modules label Oct 31, 2018
@golang golang locked and limited conversation to collaborators Oct 31, 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