golang/go

x/vgo:cannot find module providing package

tolidano opened this issue · 4 comments

make this simple file:

shawn@gallium:~/go/src/github.com/tolidano/construct$ head construct.go
package construct

import (
"github.com/YuriyNasretdinov/GoSSHa"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
)

try to vgo get:
shawn@gallium:~/go/src/github.com/tolidano/construct$ vgo get github.com/YuriyNasretdinov/GoSSHa
go: finding github.com/YuriyNasretdinov/GoSSHa latest
go get github.com/YuriyNasretdinov/GoSSHa: cannot find module providing package github.com/YuriyNasretdinov/GoSSHa

but go get:
shawn@gallium:~/go/src/github.com/tolidano/construct$ go get github.com/YuriyNasretdinov/GoSSHa

my env:
shawn@gallium:~/go/src/github.com/tolidano/construct$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/shawn/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/shawn/go"
GORACE=""
GOROOT="/usr/lib/go-1.10"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.10/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build747897478=/tmp/go-build -gno-record-gcc-switches"

go and vgo version:
shawn@gallium:~/go/src/github.com/tolidano/construct$ vgo version
go version go1.10 linux/amd64 vgo:devel +88c76dcbab

So, I figured vgo would work? I'm on GalliumOS, basically Kubuntu. Installed like this:
sudo apt-get install golang -y
sudo apt-get install golang-1.10-go -y

Now since vgo is integrated with the main repo, could you try with 1.11beta2 ? Unless you have any specific limitation, you should not need vgo anymore.

EDIT: Do you have an old git version < 2.10 ? Check #26501

@tolidano I'm not sure what your example is trying to achieve? Because it appears to be importing a main package:

cd `mktemp -d`
mkdir construct
cd construct
go mod -init -module example.com/construct
cat <<EOD > construct.go
package construct

import (
        _ "github.com/YuriyNasretdinov/GoSSHa"
        _ "github.com/aws/aws-sdk-go/aws"
        _ "github.com/aws/aws-sdk-go/aws/session"
)
EOD
go test

Using go version devel +48c79734ff

I'll close this for now because I don't think there are any module related issues here, but please shout if there's anything I've missed.

Sorry, sent the above without actually including the output:

go: finding github.com/YuriyNasretdinov/GoSSHa latest
go: finding github.com/aws/aws-sdk-go/aws/session latest
go: finding github.com/aws/aws-sdk-go/aws latest
go: downloading github.com/YuriyNasretdinov/GoSSHa v0.0.0-20170620125610-f451327954cf
go: finding github.com/aws/aws-sdk-go v1.14.31
go: downloading github.com/aws/aws-sdk-go v1.14.31
go: finding github.com/go-ini/ini v1.25.4
go: finding github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8
go: downloading github.com/go-ini/ini v1.25.4
go: downloading github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8
go: finding golang.org/x/crypto/ssh latest
go: finding golang.org/x/crypto/ssh/agent latest
go: finding golang.org/x/crypto latest
go: downloading golang.org/x/crypto v0.0.0-20180718160520-a2144134853f
construct.go:4:9: import "github.com/YuriyNasretdinov/GoSSHa" is a program, not an importable package