diff --git a/Aliases/go@1.22 b/Aliases/go@1.23 similarity index 100% rename from Aliases/go@1.22 rename to Aliases/go@1.23 diff --git a/Formula/g/go.rb b/Formula/g/go.rb index 3158c1bc7bc22..05e4eea43fb3d 100644 --- a/Formula/g/go.rb +++ b/Formula/g/go.rb @@ -1,9 +1,9 @@ class Go < Formula desc "Open source programming language to build simple/reliable/efficient software" homepage "https://go.dev/" - url "https://go.dev/dl/go1.22.6.src.tar.gz" - mirror "https://fossies.org/linux/misc/go1.22.6.src.tar.gz" - sha256 "9e48d99d519882579917d8189c17e98c373ce25abaebb98772e2927088992a51" + url "https://go.dev/dl/go1.23.0.src.tar.gz" + mirror "https://fossies.org/linux/misc/go1.23.0.src.tar.gz" + sha256 "42b7a8e80d805daa03022ed3fde4321d4c3bf2c990a144165d01eeecd6f699c6" license "BSD-3-Clause" head "https://go.googlesource.com/go.git", branch: "master" @@ -21,13 +21,13 @@ class Go < Formula end bottle do - sha256 arm64_sonoma: "17ef3a73bb9bb81ffe1740b39a1c67aaddfd4a3bd5331e8320ed2d271050bccb" - sha256 arm64_ventura: "e0c90cc0d99346b2fd15bbd2afcda14482c0e8dcca705a8d791e68ed95205e48" - sha256 arm64_monterey: "ec24fed844297c26be4a92747679b2b4812a3be5a3994c9c093752b341a12fbd" - sha256 sonoma: "495e61c0368249b6900326eb034c2f68fdca3f0080deae4d6f1910ae444a7e20" - sha256 ventura: "18832c8bc6d0ec271f953cee2f82c9aab2e6b7c0d9372f1a2aabeb87acf4f3d6" - sha256 monterey: "7fee28073754ab9139810898778d0192cd203e9c70376c3a9fe65bdc6ee2374a" - sha256 x86_64_linux: "00dd1e58e304048f0978a73b14ce69f4070e52271a121662c8dc244ad4d1f0f1" + sha256 arm64_sonoma: "9ae04e3063ff69c93dff6e982d93ed8c07114cdd50db418ddbb514c0f3cbb0a2" + sha256 arm64_ventura: "9ae04e3063ff69c93dff6e982d93ed8c07114cdd50db418ddbb514c0f3cbb0a2" + sha256 arm64_monterey: "9ae04e3063ff69c93dff6e982d93ed8c07114cdd50db418ddbb514c0f3cbb0a2" + sha256 sonoma: "78c91083ca44ee58e1eeb70286ead1564f44f570aeba12c5a7a981c059cc28a2" + sha256 ventura: "78c91083ca44ee58e1eeb70286ead1564f44f570aeba12c5a7a981c059cc28a2" + sha256 monterey: "78c91083ca44ee58e1eeb70286ead1564f44f570aeba12c5a7a981c059cc28a2" + sha256 x86_64_linux: "7ce2a2f4ebb0c620f909da574fe88b8abcf09e1c7e6acd6eb5f486a1931697c4" end # Don't update this unless this version cannot bootstrap the new version. diff --git a/Formula/g/go@1.22.rb b/Formula/g/go@1.22.rb new file mode 100644 index 0000000000000..3e865f7c51667 --- /dev/null +++ b/Formula/g/go@1.22.rb @@ -0,0 +1,98 @@ +class GoAT122 < Formula + desc "Open source programming language to build simple/reliable/efficient software" + homepage "https://go.dev/" + url "https://go.dev/dl/go1.22.6.src.tar.gz" + mirror "https://fossies.org/linux/misc/go1.22.6.src.tar.gz" + sha256 "9e48d99d519882579917d8189c17e98c373ce25abaebb98772e2927088992a51" + license "BSD-3-Clause" + + livecheck do + url "https://go.dev/dl/?mode=json" + regex(/^go[._-]?v?(1\.22(?:\.\d+)*)[._-]src\.t.+$/i) + strategy :json do |json, regex| + json.map do |release| + next if release["stable"] != true + next if release["files"].none? { |file| file["filename"].match?(regex) } + + release["version"][/(\d+(?:\.\d+)+)/, 1] + end + end + end + + bottle do + sha256 cellar: :any_skip_relocation, arm64_sonoma: "68aabbf7b2ba87f0bd6892152ca9aa0d3dd10f1bd25344ee1037ec29bdb3f936" + sha256 cellar: :any_skip_relocation, arm64_ventura: "73ba6426013ef441b6e9cd0872836eb7ea464a2d8f9fea3984110616781b2f0b" + sha256 cellar: :any_skip_relocation, arm64_monterey: "ef89ae87cd0ed55b0fd381f8bbcb42b7c52eed6e54972596d1bb1b72d89131c4" + sha256 cellar: :any_skip_relocation, sonoma: "2e68373a840d6d26569dbc554a4650a1a3904b5b153a0a4acc43d0d3e3878e87" + sha256 cellar: :any_skip_relocation, ventura: "32e9a0e9537eba8c2377a85e1bc57939e0e03847ad681b43d35d55eba58c8d82" + sha256 cellar: :any_skip_relocation, monterey: "8291e28b058d302c2f2d0ac84003601e56fe510e938da0de9adc78e6ee0fcfcf" + sha256 cellar: :any_skip_relocation, x86_64_linux: "51a51b57cd732a2a013fd0126944d6de705ee28110a9946ca10df2f862f967d2" + end + + keg_only :versioned_formula + + depends_on "go" => :build + + def install + ENV["GOROOT_BOOTSTRAP"] = buildpath/"gobootstrap" + + cd "src" do + ENV["GOROOT_FINAL"] = libexec + # Set portable defaults for CC/CXX to be used by cgo + with_env(CC: "cc", CXX: "c++") { system "./make.bash" } + end + + libexec.install Dir["*"] + bin.install_symlink Dir[libexec/"bin/go*"] + + system bin/"go", "install", "std", "cmd" + + # Remove useless files. + # Breaks patchelf because folder contains weird debug/test files + rm_r(libexec/"src/debug/elf/testdata") + # Binaries built for an incompatible architecture + rm_r(libexec/"src/runtime/pprof/testdata") + 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") + + with_env(GOOS: "freebsd", GOARCH: "amd64") do + system bin/"go", "build", "hello.go" + end + + (testpath/"hello_cgo.go").write <<~EOS + package main + + /* + #include + #include + void hello() { printf("%s\\n", "Hello from cgo!"); fflush(stdout); } + */ + import "C" + + func main() { + C.hello() + } + EOS + + # Try running a sample using cgo without CC or CXX set to ensure that the + # toolchain's default choice of compilers work + with_env(CC: nil, CXX: nil) do + assert_equal "Hello from cgo!\n", shell_output("#{bin}/go run hello_cgo.go") + end + end +end