Skip to content

go 1.16 #71289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

go 1.16 #71289

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
69 changes: 13 additions & 56 deletions Formula/go.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -74,29 +58,6 @@ def install
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
Expand All @@ -114,10 +75,6 @@ def caveats
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"
Expand Down