Skip to content

Commit 792f470

Browse files
bayandinBrewTestBot
authored andcommitted
[email protected] 1.18.5 (new formula)
Closes #107165. Signed-off-by: BrewTestBot <[email protected]>
1 parent 6b7866d commit 792f470

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

Formula/[email protected]

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
class GoAT118 < Formula
2+
desc "Open source programming language to build simple/reliable/efficient software"
3+
homepage "https://go.dev/"
4+
url "https://go.dev/dl/go1.18.5.src.tar.gz"
5+
mirror "https://fossies.org/linux/misc/go1.18.5.src.tar.gz"
6+
sha256 "9920d3306a1ac536cdd2c796d6cb3c54bc559c226fc3cc39c32f1e0bd7f50d2a"
7+
license "BSD-3-Clause"
8+
9+
livecheck do
10+
url "https://go.dev/dl/"
11+
regex(/href=.*?go[._-]?v?(1\.18(?:\.\d+)*)[._-]src\.t/i)
12+
end
13+
14+
keg_only :versioned_formula
15+
16+
# Don't update this unless this version cannot bootstrap the new version.
17+
resource "gobootstrap" do
18+
checksums = {
19+
"darwin-arm64" => "4dac57c00168d30bbd02d95131d5de9ca88e04f2c5a29a404576f30ae9b54810",
20+
"darwin-amd64" => "6000a9522975d116bf76044967d7e69e04e982e9625330d9a539a8b45395f9a8",
21+
"linux-arm64" => "3770f7eb22d05e25fbee8fb53c2a4e897da043eb83c69b9a14f8d98562cd8098",
22+
"linux-amd64" => "013a489ebb3e24ef3d915abe5b94c3286c070dfe0818d5bca8108f1d6e8440d2",
23+
}
24+
25+
arch = "arm64"
26+
platform = "darwin"
27+
28+
on_intel do
29+
arch = "amd64"
30+
end
31+
32+
on_linux do
33+
platform = "linux"
34+
end
35+
36+
boot_version = "1.16"
37+
38+
url "https://storage.googleapis.com/golang/go#{boot_version}.#{platform}-#{arch}.tar.gz"
39+
version boot_version
40+
sha256 checksums["#{platform}-#{arch}"]
41+
end
42+
43+
def install
44+
(buildpath/"gobootstrap").install resource("gobootstrap")
45+
ENV["GOROOT_BOOTSTRAP"] = buildpath/"gobootstrap"
46+
47+
cd "src" do
48+
ENV["GOROOT_FINAL"] = libexec
49+
system "./make.bash", "--no-clean"
50+
end
51+
52+
(buildpath/"pkg/obj").rmtree
53+
rm_rf "gobootstrap" # Bootstrap not required beyond compile.
54+
libexec.install Dir["*"]
55+
bin.install_symlink Dir[libexec/"bin/go*"]
56+
57+
system bin/"go", "install", "-race", "std"
58+
59+
# Remove useless files.
60+
# Breaks patchelf because folder contains weird debug/test files
61+
(libexec/"src/debug/elf/testdata").rmtree
62+
# Binaries built for an incompatible architecture
63+
(libexec/"src/runtime/pprof/testdata").rmtree
64+
end
65+
66+
test do
67+
(testpath/"hello.go").write <<~EOS
68+
package main
69+
70+
import "fmt"
71+
72+
func main() {
73+
fmt.Println("Hello World")
74+
}
75+
EOS
76+
# Run go fmt check for no errors then run the program.
77+
# This is a a bare minimum of go working as it uses fmt, build, and run.
78+
system bin/"go", "fmt", "hello.go"
79+
assert_equal "Hello World\n", shell_output("#{bin}/go run hello.go")
80+
81+
ENV["GOOS"] = "freebsd"
82+
ENV["GOARCH"] = "amd64"
83+
system bin/"go", "build", "hello.go"
84+
end
85+
end

0 commit comments

Comments
 (0)