go: warn about no-op stage_deps calls

Closes Homebrew/homebrew#49389.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
This commit is contained in:
Baptiste Fontaine 2016-02-21 13:15:12 +01:00
parent 6a1a57423b
commit bb37aa2824
2 changed files with 14 additions and 0 deletions

View File

@ -7,6 +7,7 @@ module Language
# The resource names should be the import name of the package, # The resource names should be the import name of the package,
# e.g. `resource "github.com/foo/bar"` # e.g. `resource "github.com/foo/bar"`
def self.stage_deps(resources, target) def self.stage_deps(resources, target)
opoo "tried to stage empty resources array" if resources.empty?
resources.grep(Resource::Go) { |resource| resource.stage(target) } resources.grep(Resource::Go) { |resource| resource.stage(target) }
end end
end end

View File

@ -0,0 +1,13 @@
# -*- coding: UTF-8 -*-
require "testing_env"
require "language/go"
class LanguageGoTests < Homebrew::TestCase
def test_stage_deps_empty
Language::Go.expects(:opoo).once
mktmpdir do |path|
shutup { Language::Go.stage_deps [], path }
end
end
end