-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
/
gofumpt.rb
49 lines (39 loc) 路 1.89 KB
/
gofumpt.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class Gofumpt < Formula
desc "Stricter gofmt"
homepage "https://github.com/mvdan/gofumpt"
url "https://github.com/mvdan/gofumpt/archive/v0.4.0.tar.gz"
sha256 "ba1fd89dd5a36a5443c879cd084b5626d3f8704000ec53c0d1cf5276af2bfa86"
license "BSD-3-Clause"
bottle do
sha256 cellar: :any_skip_relocation, arm64_ventura: "0bf4e734b08e64c10de6870e55b7a7a45ceb26ac179d57791b8c0d8f2b4ccb95"
sha256 cellar: :any_skip_relocation, arm64_monterey: "5a788943e18f8941a6dee5c0f60b36f9e8cd360ff5b50b3e930acfd433b8de30"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "5a788943e18f8941a6dee5c0f60b36f9e8cd360ff5b50b3e930acfd433b8de30"
sha256 cellar: :any_skip_relocation, ventura: "ecbd24a89598d20445306c97a26f182fbeeb725cf170a577d5915c9e41f87e02"
sha256 cellar: :any_skip_relocation, monterey: "2785ea620e532aba380160adfece8e20c9d09dcd7df2a630e4d2625124675cf2"
sha256 cellar: :any_skip_relocation, big_sur: "2785ea620e532aba380160adfece8e20c9d09dcd7df2a630e4d2625124675cf2"
sha256 cellar: :any_skip_relocation, catalina: "2785ea620e532aba380160adfece8e20c9d09dcd7df2a630e4d2625124675cf2"
sha256 cellar: :any_skip_relocation, x86_64_linux: "71f42aa1fb0d0af2d0a050b9f37e9648030663946015e64411eaa8823369fb35"
end
depends_on "go"
def install
ldflags = "-s -w -X mvdan.cc/gofumpt/internal/version.version=#{version}"
system "go", "build", *std_go_args(ldflags: ldflags)
end
test do
# upstream issue tracker, https://github.com/mvdan/gofumpt/issues/253
# assert_match version.to_s, shell_output("#{bin}/gofumpt --version")
(testpath/"test.go").write <<~EOS
package foo
func foo() {
println("bar")
}
EOS
(testpath/"expected.go").write <<~EOS
package foo
func foo() {
println("bar")
}
EOS
assert_match shell_output("#{bin}/gofumpt test.go"), (testpath/"expected.go").read
end
end