diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index b69fbcfb78..7824052074 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -885,6 +885,10 @@ class FormulaAuditor problem "Formulae using virtualenvs do not need a `setuptools` resource." end + if text =~ /system\s+['"]go['"],\s+['"]get['"]/ + problem "Formulae should not use `go get`. If non-vendored resources are required use `go_resource`s." + end + return unless text.include?('require "language/go"') && !text.include?("go_resource") problem "require \"language/go\" is unnecessary unless using `go_resource`s" end diff --git a/Library/Homebrew/test/dev-cmd/audit_spec.rb b/Library/Homebrew/test/dev-cmd/audit_spec.rb index 9afb7954ae..771e1ee799 100644 --- a/Library/Homebrew/test/dev-cmd/audit_spec.rb +++ b/Library/Homebrew/test/dev-cmd/audit_spec.rb @@ -430,6 +430,21 @@ describe FormulaAuditor do expect(fa.problems.first) .to match('xcodebuild should be passed an explicit "SYMROOT"') end + + specify "disallow go get usage" do + fa = formula_auditor "foo", <<-EOS.undent + class Foo