简体   繁体   中英

go mod init with private bitbucket repositories, contains disallowed path separator character ':'

Using:

% go version
go version go1.16.4 darwin/amd64

I've got a private bitbucket.org repository with a url like:

git@bitbucket.org:chmorgan/some_repo.git

Per the bitbucket url format you would do 'git clone git@bitbucket.org:chmorgan/some_repo.git' to clone it and cloning works fine.

When I try to make a new module I get:

go mod init git@bitbucket.org:chmorgan/some_repo.git
go: invalid module path "git@bitbucket.org:chmorgan/some_repo.git": contains disallowed path separator character ':'

Note that I've already configured git in ~/.gitconfig:

[url "git@bitbucket.org:"]
        insteadOf = https://bitbucket.org/

This used to work with earlier golfing versions, I think it worked with golang 1.12 or 1.13. Anyone know what's up?

The argument to go mod init is the “module path”, which is used as a prefix of the package import path for every package within the module. As a result, the argument to go mod init must be valid as a package import path.

(See https://golang.org/doc/code for more detail.)

The package import path we would normally use for a repo cloned from git@bitbucket.org:chmorgan/some_repo.git is bitbucket.org/chmorgan/some_repo .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM