我正在运行Ubuntu 18.04,但在我的计算机上安装时遇到了一些麻烦。我使用了以下snap命令:
sudo snap install go --classic
似乎可行,我可以运行go version
并获取版本。
然后我将工作空间路径设置为:
export GOPATH=$HOME/my/name/projects/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
然后我尝试使用go内置的git工具通过编写来克隆Google存储库
go get -d -u github.com/google/battery-historian
但这会导致一堆错误,提示无法识别的导入路径:
package bytes: unrecognized import path "bytes" (import path does not begin with hostname)
package flag: unrecognized import path "flag" (import path does not begin with hostname)
package fmt: unrecognized import path "fmt" (import path does not begin with hostname)
package archive/zip: unrecognized import path "archive/zip" (import path does not begin with hostname)
package errors: unrecognized import path "errors" (import path does not begin with hostname)
package compress/gzip: unrecognized import path "compress/gzip" (import path does not begin with hostname)
package os/exec: unrecognized import path "os/exec" (import path does not begin with hostname)
package regexp: unrecognized import path "regexp" (import path does not begin with hostname)
package strconv: unrecognized import path "strconv" (import path does not begin with hostname)
package strings: unrecognized import path "strings" (import path does not begin with hostname)
package time: unrecognized import path "time" (import path does not begin with hostname)
package bufio: unrecognized import path "bufio" (import path does not begin with hostname)
package encoding: unrecognized import path "encoding" (import path does not begin with hostname)
package encoding/json: unrecognized import path "encoding/json" (import path does not begin with hostname)
package io: unrecognized import path "io" (import path does not begin with hostname)
package log: unrecognized import path "log" (import path does not begin with hostname)
package math: unrecognized import path "math" (import path does not begin with hostname)
package reflect: unrecognized import path "reflect" (import path does not begin with hostname)
package sort: unrecognized import path "sort" (import path does not begin with hostname)
package sync: unrecognized import path "sync" (import path does not begin with hostname)
package sync/atomic: unrecognized import path "sync/atomic" (import path does not begin with hostname)
package unicode/utf8: unrecognized import path "unicode/utf8" (import path does not begin with hostname)
package unsafe: unrecognized import path "unsafe" (import path does not begin with hostname)
package net/http: unrecognized import path "net/http" (import path does not begin with hostname)
package io/ioutil: unrecognized import path "io/ioutil" (import path does not begin with hostname)
package os: unrecognized import path "os" (import path does not begin with hostname)
package path: unrecognized import path "path" (import path does not begin with hostname)
package path/filepath: unrecognized import path "path/filepath" (import path does not begin with hostname)
package runtime: unrecognized import path "runtime" (import path does not begin with hostname)
我按照https://github.com/google/battery-historian
上的说明进行操作我还尝试将GOBIN设置为export GOBIN=snap/go/current/bin
,因为我认为有安装go bin的位置,但似乎没有任何区别。
我在这里做什么错了?