Nie mogę zmusić Golanga do pracy w Ubuntu
Ok, więc pobrałem Go 1.1 i umieściłem go w $ HOME / Documents / go.
Potem zmodyfikowałem moje.bashrc
być:
export GOPATH=$HOME/Documents/go
export GOROOT=$GOPATH
export GOARCH=amd64
export GOOS=linux
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
Potem kupiłem.bashrc
i próbowałem:
jan@janpc:~$ go version
go version go1.1 linux/amd64
Ale nie mogę go skompilować ani zainstalować żadnych zależności. Na przykład. Próbuję uruchomić mój mały program testowy:
jan@janpc:~/Documents/go/src/github.com/jan/scrypt$ go run scrypt.go
warning: GOPATH set to GOROOT (/home/jan/Documents/go) has no effect
scrypt.go:9:3: cannot find package "github.com/dchest/scrypt" in any of:
/home/jan/Documents/go/src/pkg/github.com/dchest/scrypt (from $GOROOT)
($GOPATH not set)
jan@janpc:~/Documents/go/src/github.com/jan/scrypt$
A kiedy próbuję zainstalować zależności:
jan@janpc:~/Documents/go/src/github.com/jan/scrypt$ go get "github.com/dchest/scrypt"
warning: GOPATH set to GOROOT (/home/jan/Documents/go) has no effect
package github.com/dchest/scrypt: cannot download, $GOPATH must not be set to $GOROOT. For more details see: go help gopath
Kompiluje się i działa poprawnie na mac. Nie mogę zrozumieć, co jest nie tak z moją konfiguracją, jeśli spróbuję usunąć$GOROOT
lub$GOPATH
nic nie działa i nie wiem, do czego jeszcze je ustawić, poza ścieżką do Go.
EDYCJA: Nie ma ustawionego $ GOROOT na moim komputerze Mac. Ale jeśli usunę$GOROOT
na ubuntu, gdy próbuję się skompilować, otrzymuję takie błędy.
cannot find package "fmt" in any of:
/usr/local/go/src/pkg/fmt (from $GOROOT)
/home/jan/Documents/go/src/fmt (from $GOPATH)