在从GitHub上使用”go get -u”命令后,出现”golang – ‘not a package file'”的错误提示。

huangapple go评论83阅读模式
英文:

golang - "not a package file" after "go get -u" from github

问题

我正在尝试使用以下命令安装govendor

go get -u github.com/kardianos/govendor

但每次都会出现以下错误:

# github.com/kardianos/govendor/cliprompt
go/src/github.com/kardianos/govendor/cliprompt/cliPrompt.go:13:2: import /home/pelli/go/pkg/linux_amd64/github.com/kardianos/govendor/prompt.a: not a package file

# github.com/kardianos/govendor/context
go/src/github.com/kardianos/govendor/context/context.go:18:2: import /home/pelli/go/pkg/linux_amd64/github.com/kardianos/govendor/internal/pathos.a: not a package file

我正在使用以下环境的golang版本1.9 linux/amd64:

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/pelli/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build215462614=/tmp/go-build -gno-record-gcc-switches"
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"

是什么导致了这些问题?谢谢。

英文:

I am tryng to install govendor using the command
go get -u github.com/kardianos/govendor

but everytime I get the following

# github.com/kardianos/govendor/cliprompt
go/src/github.com/kardianos/govendor/cliprompt/cliPrompt.go:13:2: import /home/pelli/go/pkg/linux_amd64/github.com/kardianos/govendor/prompt.a: not a package file

# github.com/kardianos/govendor/context
go/src/github.com/kardianos/govendor/context/context.go:18:2: import /home/pelli/go/pkg/linux_amd64/github.com/kardianos/govendor/internal/pathos.a: not a package file

I am using golang version 1.9 linux/amd64 with the following env:

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/pelli/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build215462614=/tmp/go-build -gno-record-gcc-switches"
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"

What is causing these issues?
Thank you

答案1

得分: 1

我已经解决了清理$GOPATH/pkg文件夹的问题,并重新执行了以下命令:
go get -u github.com/kardianos/govendor

英文:

I have solved cleaning my $GOPATH/pkg folder and then re-executing:
go get -u github.com/kardianos/govendor

huangapple
  • 本文由 发表于 2017年9月4日 18:40:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/46035305.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定