2020-10-10 14:16:11 +02:00
|
|
|
# typed: true
|
2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-06-02 23:32:42 -07:00
|
|
|
require "resource"
|
|
|
|
|
|
|
|
module Language
|
2020-08-17 18:58:28 +02:00
|
|
|
# Helper functions for Go formulae.
|
|
|
|
#
|
|
|
|
# @api public
|
2014-06-02 23:32:42 -07:00
|
|
|
module Go
|
|
|
|
# Given a set of resources, stages them to a gopath for
|
|
|
|
# building go software.
|
|
|
|
# The resource names should be the import name of the package,
|
|
|
|
# e.g. `resource "github.com/foo/bar"`
|
2015-08-03 13:09:07 +01:00
|
|
|
def self.stage_deps(resources, target)
|
2016-07-10 14:10:55 +01:00
|
|
|
if resources.empty?
|
2020-04-05 15:44:50 +01:00
|
|
|
if Homebrew::EnvConfig.developer?
|
2016-07-10 14:10:55 +01:00
|
|
|
odie "tried to stage empty Language::Go resources array"
|
|
|
|
else
|
|
|
|
opoo "tried to stage empty Language::Go resources array"
|
|
|
|
end
|
|
|
|
end
|
2014-09-07 14:07:12 -05:00
|
|
|
resources.grep(Resource::Go) { |resource| resource.stage(target) }
|
2014-06-02 23:32:42 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|