Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audit: formally ban go get usage #2562

Merged
merged 2 commits into from
Apr 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions Library/Homebrew/dev-cmd/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,10 @@ def audit_text
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
Expand Down
15 changes: 15 additions & 0 deletions Library/Homebrew/test/dev-cmd/audit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,21 @@ def install
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 <Formula
url "http://example.com/foo-1.0.tgz"

def install
system "go", "get", "bar"
end
end
EOS
fa.audit_text
expect(fa.problems.first)
.to match("Formulae should not use `go get`. If non-vendored resources are required use `go_resource`s.")
end
end

describe "#audit_revision_and_version_scheme" do
Expand Down