Skip to content

cmd/go: custom import path private repos require special configuration #27254

Closed
@chowey

Description

@chowey

Please answer these questions before submitting your issue. Thanks!

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

go version go1.11 darwin/amd64

Does this issue reproduce with the latest release?

Yes.

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

GOARCH="amd64"
GOOS="darwin"

What did you do?

I have a private repo served over ssh, using gitolite.

That private repo is a package I want to use, at e.g. private.repo.net/user/package. It has a folder structure like this:

README.md
a/a.go
b/b.go

My global .gitconfig looks like this, so that go get works:

[url "ssh://[email protected]"]
        insteadOf = https://private.repo.net

In my main package my/package, I have a go file that imports it like this:

import "private.repo.net/user/package/a"

This used to work when using the old $GOPATH. Now I am trying to use modules instead. I run go build my/package which should resolve dependencies and build.

What did you expect to see?

I expected it to build.

What did you see instead?

build my/package: cannot find module for path private.repo.net/user/package/a

I also tried adding it to the go.mod file by running go get private.repo.net/user/package.git. (NOTE: I need to use .git so that it uses ssh.) So it now private.repo.net/user/package.git appears in my go.mod file.

However, when I do go build, it still complains that "build my/package: cannot find module for path private.repo.net/user/package/a".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions