Skip to content

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

@distinctdan

Description

@distinctdan

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions