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

Go modules with using Github on init url causes error #35267

Closed
jbramsden opened this issue Oct 31, 2019 · 4 comments
Closed

Go modules with using Github on init url causes error #35267

jbramsden opened this issue Oct 31, 2019 · 4 comments
Labels
FrozenDueToAge modules WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@jbramsden
Copy link

jbramsden commented Oct 31, 2019

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

$ go version
go version go1.13.3 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/jbramsden/Library/Caches/go-build"
GOENV="/Users/jbramsden/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/jbramsden/go"
GOPRIVATE=""
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/jbramsden/src/gomod/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/pd/0gyhy71j73s7ph1xn_jrc7zc0000gn/T/go-build859523199=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Using the following as an example: https://blog.golang.org/using-go-modules

But used my Github URL instead of example.com:
go mod init github.com/jbramden/hello
Created a sub directory for world

 mkdir world
 cd world

added world.go with the following

package world

func World() string {
	return "world."
}

changed hello.go to call world using the import path as stated in the go mod init and called World().

package hello

import (
	"github.com/jbramsden/hello/world"
	"fmt"
)

func Hello() string {
	return fmt.Sprintf("Hello, %s", world.World())
}

then I run go test and I should see the test results.

What did you expect to see?

PASS
github.com/jbramsden/hello 0.007s

What did you see instead?

bash-3.2$ go test
hello.go:4:2: git ls-remote -q https://github.com/jbramsden/hello in /Users/jbramsden/go/pkg/mod/cache/vcs/c2625a56b67add752fe30dd618aa886e71e6f3a95817f75a91890900f68dacfc: exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.

What else did you try?

If I remove go.mod file and run

 rm go.mod
 go mod init example.com/hello

Then I change hello.go to have the correct path for import
"example.com/hello/world

And I rerun
go test

I get the expect results

PASS
example.com/hello 0.007s

I also tested this with other URLs other then github.com and it works correctly. E.G bitbucket.com

What do you think is happening?

For Github it is expecting the code to be checked in and trying to download it. However this is working differently from any other URL.

@aofei
Copy link
Contributor

aofei commented Oct 31, 2019

So, is the jbramsden/hello a private repo? If so, then see golang.org/doc/faq#git_https as go said.

@jbramsden
Copy link
Author

Hi aofei,

No jbramsden/hello is not a private repo, it does not exist in github.

@bcmills
Copy link
Contributor

bcmills commented Nov 5, 2019

This appears to be due to a typo in your go mod init command:

go mod init github.com/jbramden/hello

s/jbramden/jbramsden/ and you should be set, but please let us know if that doesn't work.

@bcmills bcmills added modules WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Nov 5, 2019
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Dec 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants