| Copyright 2020 The Monogon Project Authors. | 
 |  | 
 | Licensed under the Apache License, Version 2.0 (the "License"); | 
 | you may not use this file except in compliance with the License. | 
 | You may obtain a copy of the License at | 
 |  | 
 |   http://www.apache.org/licenses/LICENSE-2.0 | 
 |  | 
 | Unless required by applicable law or agreed to in writing, software | 
 | distributed under the License is distributed on an "AS IS" BASIS, | 
 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
 | See the License for the specific language governing permissions and | 
 | limitations under the License. | 
 |  | 
 |  | 
 | From 6313aef65ed37aa971737058af391f5be1ae976c Mon Sep 17 00:00:00 2001 | 
 | From: Lorenz Brun <lorenz@nexantic.com> | 
 | Date: Wed, 3 Feb 2021 18:11:03 +0100 | 
 | Subject: [PATCH] Don't use run_shell with list as cmd | 
 |  | 
 | Going upstream at https://github.com/kubernetes/repo-infra/pull/225 | 
 | --- | 
 |  defs/go.bzl | 26 ++++++++++++++------------ | 
 |  1 file changed, 14 insertions(+), 12 deletions(-) | 
 |  | 
 | diff --git a/defs/go.bzl b/defs/go.bzl | 
 | index 21cffdd..f4617e1 100644 | 
 | --- a/defs/go.bzl | 
 | +++ b/defs/go.bzl | 
 | @@ -63,16 +63,7 @@ def _go_genrule_impl(ctx): | 
 |   | 
 |      srcs = [src for srcs in ctx.attr.srcs for src in srcs.files.to_list()] | 
 |   | 
 | -    deps = depset( | 
 | -        gopath_files + srcs, | 
 | -        transitive = | 
 | -            # tools | 
 | -            [dep.files for dep in ctx.attr.tools] + | 
 | -            # go toolchain | 
 | -            [depset(go.sdk.libs + go.sdk.srcs + go.sdk.tools + [go.sdk.go])], | 
 | -    ) | 
 | - | 
 | -    _, cmd, _ = ctx.resolve_command( | 
 | +    inputs, cmd, input_manifests = ctx.resolve_command( | 
 |          command = ctx.attr.cmd, | 
 |          attribute = "cmd", | 
 |          expand_locations = True, | 
 | @@ -83,6 +74,15 @@ def _go_genrule_impl(ctx): | 
 |          tools = ctx.attr.tools, | 
 |      ) | 
 |   | 
 | +    deps = depset( | 
 | +        gopath_files + srcs + inputs, | 
 | +        transitive = | 
 | +            # tools | 
 | +            [dep.files for dep in ctx.attr.tools] + | 
 | +            # go toolchain | 
 | +            [depset(go.sdk.libs + go.sdk.srcs + go.sdk.tools + [go.sdk.go])], | 
 | +    ) | 
 | + | 
 |      env = dict() | 
 |      env.update(ctx.configuration.default_shell_env) | 
 |      env.update(go.env) | 
 | @@ -92,11 +92,13 @@ def _go_genrule_impl(ctx): | 
 |          "GOROOT": paths.dirname(go.sdk.root_file.path), | 
 |      }) | 
 |   | 
 | -    ctx.actions.run_shell( | 
 | +    ctx.actions.run( | 
 |          inputs = deps, | 
 |          outputs = ctx.outputs.outs, | 
 |          env = env, | 
 | -        command = cmd, | 
 | +        executable = cmd[0], | 
 | +        arguments = cmd[1:], | 
 | +        input_manifests = input_manifests, | 
 |          progress_message = "%s %s" % (ctx.attr.message, ctx), | 
 |          mnemonic = "GoGenrule", | 
 |      ) | 
 | --  | 
 | 2.25.1 | 
 |  |