Closes #71289.

Co-authored-by: Bo Anderson <mail@boanderson.me>
Signed-off-by: Bo Anderson <mail@boanderson.me>
master
circa10a 2021-02-16 13:28:34 -06:00 committed by Bo Anderson
parent 35fd4721b6
commit 519e021f74
2 changed files with 13 additions and 56 deletions

View File

@ -2,23 +2,12 @@ class Go < Formula
desc "Open source programming language to build simple/reliable/efficient software"
homepage "https://golang.org"
license "BSD-3-Clause"
head "https://go.googlesource.com/go.git"
stable do
if Hardware::CPU.arm?
url "https://golang.org/dl/go1.16rc1.src.tar.gz"
sha256 "6a33569f9d0d21db31614086cc2a4f0fbc683b41c1c53fb512a1341ce5763ff5"
version "1.15.8"
else
url "https://golang.org/dl/go1.15.8.src.tar.gz"
mirror "https://fossies.org/linux/misc/go1.15.8.src.tar.gz"
sha256 "540c0ab7781084d124991321ed1458e479982de94454a98afab6acadf38497c2"
end
go_version = version.major_minor
resource "gotools" do
url "https://go.googlesource.com/tools.git",
branch: "release-branch.go#{go_version}"
end
url "https://golang.org/dl/go1.16.src.tar.gz"
mirror "https://fossies.org/linux/misc/go1.16.src.tar.gz"
sha256 "7688063d55656105898f323d90a79a39c378d86fe89ae192eb3b7fc46347c95a"
end
livecheck do
@ -33,29 +22,24 @@ class Go < Formula
sha256 mojave: "3500c34a8659c2c1f0fe4f0e41dc0a64d77841f31bde38e0c94139698a1e02b1"
end
head do
url "https://go.googlesource.com/go.git"
resource "gotools" do
url "https://go.googlesource.com/tools.git"
end
end
# Don't update this unless this version cannot bootstrap the new version.
resource "gobootstrap" do
on_macos do
if Hardware::CPU.arm?
url "https://storage.googleapis.com/golang/go1.16beta1.darwin-arm64.tar.gz"
sha256 "fd57f47987bb330fd9b438e7b4c8941b63c3807366602d99c1d99e0122ec62f1"
url "https://storage.googleapis.com/golang/go1.16.darwin-arm64.tar.gz"
version "1.16"
sha256 "4dac57c00168d30bbd02d95131d5de9ca88e04f2c5a29a404576f30ae9b54810"
else
url "https://storage.googleapis.com/golang/go1.7.darwin-amd64.tar.gz"
sha256 "51d905e0b43b3d0ed41aaf23e19001ab4bc3f96c3ca134b48f7892485fc52961"
url "https://storage.googleapis.com/golang/go1.16.darwin-amd64.tar.gz"
version "1.16"
sha256 "6000a9522975d116bf76044967d7e69e04e982e9625330d9a539a8b45395f9a8"
end
end
on_linux do
url "https://storage.googleapis.com/golang/go1.7.linux-amd64.tar.gz"
sha256 "702ad90f705365227e902b42d91dd1a40e48ca7f67a2f4b2fd052aaa4295cd95"
url "https://storage.googleapis.com/golang/go1.16.linux-amd64.tar.gz"
version "1.16"
sha256 "013a489ebb3e24ef3d915abe5b94c3286c070dfe0818d5bca8108f1d6e8440d2"
end
end
@ -74,29 +58,6 @@ class Go < Formula
bin.install_symlink Dir[libexec/"bin/go*"]
system bin/"go", "install", "-race", "std"
# Build and install godoc
ENV.prepend_path "PATH", bin
ENV["GOPATH"] = buildpath
(buildpath/"src/golang.org/x/tools").install resource("gotools")
cd "src/golang.org/x/tools/cmd/godoc/" do
system "go", "build"
(libexec/"bin").install "godoc"
end
bin.install_symlink libexec/"bin/godoc"
end
def caveats
s = ""
if Hardware::CPU.arm?
s += <<~EOS
This is a release candidate version of the Go compiler for Apple Silicon
(Go 1.16rc1).
EOS
end
s
end
test do
@ -114,10 +75,6 @@ class Go < Formula
system bin/"go", "fmt", "hello.go"
assert_equal "Hello World\n", shell_output("#{bin}/go run hello.go")
# godoc was installed
assert_predicate libexec/"bin/godoc", :exist?
assert_predicate libexec/"bin/godoc", :executable?
ENV["GOOS"] = "freebsd"
ENV["GOARCH"] = "amd64"
system bin/"go", "build", "hello.go"