【发布时间】:2018-06-13 08:50:19
【问题描述】:
我想编写一个 Homebrew 公式来安装 Go 包及其依赖项。到目前为止,这是我所得到的:
class LsGo < Formula
desc "A more colorful, user-friendly implementation of `ls` written in Go"
homepage "https://github.com/acarl005/ls-go"
url "https://github.com/acarl005/ls-go/archive/v0.0.0.tar.gz"
sha256 "db9ba7300fbbaf92926b2c95fd63e3e936739e359f123b5a45e6ca04b490af51"
depends_on "go" => :build
def install
ENV["GOPATH"] = buildpath
(buildpath/"src/github.com/acarl005").mkpath
ln_s buildpath, buildpath/"src/github.com/acarl005/ls-go"
system "cd", buildpath/"src/github.com/acarl005/ls-go"
system "go", "get", "./"
system "cd", "-"
system "go", "build", "-o", bin/"ls-go"
end
test do
system bin/"ls-go", "--help"
end
end
但我收到关于在$GOPATH 之外运行go get ./ 的错误。
==> cd /private/tmp/ls-go-20180612-22435-oidqms/ls-go-0.0.0/src/github.com/acarl005/ls-go
==> go get ./
Last 15 lines from /Users/andy/Library/Logs/Homebrew/ls-go/02.go:
2018-06-12 16:31:14 -0700
go
get
./
go get: no install location for directory /private/tmp/ls-go-20180612-22435-oidqms/ls-go-0.0.0 outside GOPATH
这对我来说没有意义。我将ENV["GOPATH"] 设置为/private/tmp/ls-go-20180612-22435-oidqms/ls-go-0.0.0/,然后cd 到该路径的子目录中。为什么说我在$GOPATH之外?
我应该如何获取我的包的依赖项?
编辑:我宁愿避免出售包。
【问题讨论】: