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

Can't import package from non-github repo #43251

Closed
distinctdan opened this issue Dec 17, 2020 · 3 comments
Closed

Can't import package from non-github repo #43251

distinctdan opened this issue Dec 17, 2020 · 3 comments

Comments

@distinctdan
Copy link

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

1.15.2

Does this issue reproduce with the latest release?

Not sure

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

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/my.user/Library/Caches/go-build"
GOENV="/Users/my.user/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/my.user/go/pkg/mod"
GONOPROXY="github.com/myOrg,git.cloud.myorg.com/devs-group"
GONOSUMDB="github.com/myOrg,git.cloud.myorg.com/devs-group"
GOOS="darwin"
GOPATH="/Users/my.user/go"
GOPRIVATE="github.com/myOrg,git.cloud.myorg.com/devs-group"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/my.user/git/my-project/tests/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/x7/jzrn96rn02765bbr_chytlh80000gn/T/go-build939570978=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I'm trying to import a module at a specific commit from my company's gitlab instance. However, I'm getting the error:

go get git.cloud.myorg.com/devs-group/sdk-go@04819860ddec21ebeeaa9e3be102eb51f39a0304
go: git.cloud.myorg.com/devs-group/sdk-go 04819860ddec21ebeeaa9e3be102eb51f39a0304 => v1.33.1-0.20201216225153-04819860ddec
go get: git.cloud.myorg.com/devs-group/sdk-go@v1.33.1-0.20201216225153-04819860ddec: parsing go.mod:
	module declares its path as: github.com/myorg/sdk-go
	        but was required as: git.cloud.myorg.com/devs-group/sdk-go

The module I'm trying to import is mirrored from a private github repo, hence the github path. We're hosting it on gitlab to expose it to external users. So a couple of questions:

  1. Why does Go care about the module's self-declared path? Why can't I just import it?
  2. I'm not sure I can change the path in sdk-go's go.mod, since others in my org are using this module, so is there a way to get this to work?
@mvdan
Copy link
Member

mvdan commented Dec 17, 2020

The Go project doesn't use the issue tracker for questions. See https://golang.org/wiki/Questions.

@mvdan mvdan closed this as completed Dec 17, 2020
@distinctdan
Copy link
Author

This isn't just a question, Go's won't import a module, which sounds like a bug to me.

@mvdan
Copy link
Member

mvdan commented Dec 17, 2020

A module has exactly one path, and it can only be used with that path. See go help modules, or see the link above if you want further help. I'm sorry, but I don't see a bug report here.

@golang golang locked and limited conversation to collaborators Dec 17, 2021
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