Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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.
20 changes: 10 additions & 10 deletions Formula/g/go.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ class Go < Formula
desc "Open source programming language to build simple/reliable/efficient software"
homepage "https://go.dev/"
license "BSD-3-Clause"
revision 1
compatibility_version 1
compatibility_version 2
head "https://go.googlesource.com/go.git", branch: "master"

stable do
url "https://go.dev/dl/go1.25.7.src.tar.gz"
mirror "https://fossies.org/linux/misc/go1.25.7.src.tar.gz"
sha256 "178f2832820274b43e177d32f06a3ebb0129e427dd20a5e4c88df2c1763cf10a"
url "https://go.dev/dl/go1.26.0.src.tar.gz"
mirror "https://fossies.org/linux/misc/go1.26.0.src.tar.gz"
sha256 "c9132a8a1f6bd2aa4aad1d74b8231d95274950483a4950657ee6c56e6e817790"

# patch to fix pkg-config flag sanitization
# Backport issue https://golang.org/issue/77474, should be included in 1.26.1+.
patch do
url "https://github.com/golang/go/commit/28fbdf7acb4146b5bc3d88128e407d1344691839.patch?full_index=1"
sha256 "2e05f7e16f2320685547a7ebb240163a8b7f1c7bf9d2f6dc4872ff8b27707a35"
Expand Down Expand Up @@ -45,13 +45,13 @@ class Go < Formula
# Don't update this unless this version cannot bootstrap the new version.
resource "gobootstrap" do
checksums = {
"darwin-arm64" => "416c35218edb9d20990b5d8fc87be655d8b39926f15524ea35c66ee70273050d",
"darwin-amd64" => "e7bbe07e96f0bd3df04225090fe1e7852ed33af37c43a23e16edbbb3b90a5b7c",
"linux-arm64" => "fd017e647ec28525e86ae8203236e0653242722a7436929b1f775744e26278e7",
"linux-amd64" => "4fa4f869b0f7fc6bb1eb2660e74657fbf04cdd290b5aef905585c86051b34d43",
"darwin-arm64" => "f282d882c3353485e2fc6c634606d85caf36e855167d59b996dbeae19fa7629a",
"darwin-amd64" => "6cc6549b06725220b342b740497ffd24e0ebdcef75781a77931ca199f46ad781",
"linux-arm64" => "74d97be1cc3a474129590c67ebf748a96e72d9f3a2b6fef3ed3275de591d49b3",
"linux-amd64" => "1fc94b57134d51669c72173ad5d49fd62afb0f1db9bf3f798fd98ee423f8d730",
}

version "1.22.12"
version "1.24.13"

on_arm do
on_macos do
Expand Down
95 changes: 95 additions & 0 deletions Formula/g/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
class GoAT125 < Formula
desc "Open source programming language to build simple/reliable/efficient software"
homepage "https://go.dev/"
url "https://go.dev/dl/go1.25.7.src.tar.gz"
mirror "https://fossies.org/linux/misc/go1.25.7.src.tar.gz"
sha256 "178f2832820274b43e177d32f06a3ebb0129e427dd20a5e4c88df2c1763cf10a"
license "BSD-3-Clause"
revision 1
compatibility_version 1

livecheck do
url "https://go.dev/dl/?mode=json"
regex(/^go[._-]?v?(1\.25(?:\.\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

keg_only :versioned_formula

depends_on "go" => :build

# patch to fix pkg-config flag sanitization
# Backport issue https://golang.org/issue/77438, should be included in 1.25.8+.
patch do
url "https://github.com/golang/go/commit/28fbdf7acb4146b5bc3d88128e407d1344691839.patch?full_index=1"
sha256 "2e05f7e16f2320685547a7ebb240163a8b7f1c7bf9d2f6dc4872ff8b27707a35"
end

def install
libexec.install Dir["*"]

cd libexec/"src" do
# Set portable defaults for CC/CXX to be used by cgo
with_env(CC: "cc", CXX: "c++") { system "./make.bash" }
end

bin.install_symlink Dir[libexec/"bin/go*"]

# 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")
# Remove testdata with binaries for non-native architectures.
rm_r(libexec/"src/debug/dwarf/testdata")
end

test do
(testpath/"hello.go").write <<~GO
package main

import "fmt"

func main() {
fmt.Println("Hello World")
}
GO

# 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 <<~GO
package main

/*
#include <stdlib.h>
#include <stdio.h>
void hello() { printf("%s\\n", "Hello from cgo!"); fflush(stdout); }
*/
import "C"

func main() {
C.hello()
}
GO

# 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, CGO_ENABLED: "1") do
assert_equal "Hello from cgo!\n", shell_output("#{bin}/go run hello_cgo.go")
end
end
end
1 change: 1 addition & 0 deletions Formula/g/golangci-lint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class GolangciLint < Formula
tag: "v2.8.0",
revision: "e2e40021c9007020676c93680a36e3ab06c6cd33"
license "GPL-3.0-only"
revision 1
head "https://github.com/golangci/golangci-lint.git", branch: "main"

bottle do
Expand Down
Loading