doumo0206 2015-01-16 09:40
浏览 339

Golang编译器/设置go路径出现问题

I have attempted setting a go path to multiple directories using export, i.e

export GOPATH=$(mktemp -d)

or

export GOPATH="$HOME/go"

etc.

I have attempted using multiple directories yet when I attempt to run "go get" I always run into the same error.

/usr/lib/go/src/pkg/github.com/golang/protobuf/proto/text.go:39:2: no Go source files in /usr/lib/go/src/pkg/encoding

All signs seem to point to the gopath not being set but I can assure you I have set it multiple times attempting to troubleshoot and when I cd to $GOPATH it brings me to the gopath I set.

If it is of any concern this is the repository I am attempting to access:

https://github.com/layeh/piepan

Thank you

  • 写回答

2条回答 默认 最新

  • dox19458 2015-04-09 18:18
    关注

    The GOPATH environment variable specifies the location of your workspace. It is likely the only environment variable you'll need to set when developing Go code.

    To get started, create a workspace directory and set GOPATH accordingly. Your workspace can be located wherever you like, but we'll use $HOME/go in this document. Note that this must not be the same path as your Go installation.

    $ mkdir $HOME/go

    $ export GOPATH=$HOME/go

    For convenience, add the workspace's bin subdirectory to your PATH:

    $ export PATH=$PATH:$GOPATH/bin

    you have to add you $GOPATH to $PATH, execute highlighted commands (change to your path)

    评论

报告相同问题?