74 lines
2.2 KiB
Ruby
74 lines
2.2 KiB
Ruby
class GoAT115 < Formula
|
|
desc "Go programming environment (1.15)"
|
|
homepage "https://golang.org"
|
|
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"
|
|
license "BSD-3-Clause"
|
|
|
|
livecheck do
|
|
url "https://golang.org/dl/"
|
|
regex(/href=.*?go[._-]?v?(1\.15(?:\.\d+)*)[._-]src\.t/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 big_sur: "d834e8f821cc8470de4699e2be8beec90ce57c6628c7c6b4c5796e9713af6a2a"
|
|
sha256 catalina: "8b58e424ed6335ee2a71aa7f57f8d6a0651295186e22db405cadafc903b6afd7"
|
|
sha256 mojave: "e93719a925a35950ca9a27fa6344c8fb3f4133cc587927a53648c290157a58e8"
|
|
end
|
|
|
|
keg_only :versioned_formula
|
|
|
|
depends_on arch: :x86_64
|
|
|
|
# Don't update this unless this version cannot bootstrap the new version.
|
|
resource "gobootstrap" do
|
|
on_macos do
|
|
url "https://storage.googleapis.com/golang/go1.7.darwin-amd64.tar.gz"
|
|
sha256 "51d905e0b43b3d0ed41aaf23e19001ab4bc3f96c3ca134b48f7892485fc52961"
|
|
end
|
|
|
|
on_linux do
|
|
url "https://storage.googleapis.com/golang/go1.7.linux-amd64.tar.gz"
|
|
sha256 "702ad90f705365227e902b42d91dd1a40e48ca7f67a2f4b2fd052aaa4295cd95"
|
|
end
|
|
end
|
|
|
|
def install
|
|
(buildpath/"gobootstrap").install resource("gobootstrap")
|
|
ENV["GOROOT_BOOTSTRAP"] = buildpath/"gobootstrap"
|
|
|
|
cd "src" do
|
|
ENV["GOROOT_FINAL"] = libexec
|
|
system "./make.bash", "--no-clean"
|
|
end
|
|
|
|
(buildpath/"pkg/obj").rmtree
|
|
rm_rf "gobootstrap" # Bootstrap not required beyond compile.
|
|
libexec.install Dir["*"]
|
|
bin.install_symlink Dir[libexec/"bin/go*"]
|
|
|
|
system bin/"go", "install", "-race", "std"
|
|
end
|
|
|
|
test do
|
|
(testpath/"hello.go").write <<~EOS
|
|
package main
|
|
|
|
import "fmt"
|
|
|
|
func main() {
|
|
fmt.Println("Hello World")
|
|
}
|
|
EOS
|
|
# Run go fmt check for no errors then run the program.
|
|
# This is a a bare minimum of go working as it uses fmt, build, and run.
|
|
system bin/"go", "fmt", "hello.go"
|
|
assert_equal "Hello World\n", shell_output("#{bin}/go run hello.go")
|
|
|
|
ENV["GOOS"] = "freebsd"
|
|
ENV["GOARCH"] = "amd64"
|
|
system bin/"go", "build", "hello.go"
|
|
end
|
|
end
|