bazel构建给出“参数列表太长”错误

Trying to build go application using bazel. It fails due to multiple packages and source files present within the application.

  • OS: Mac OS (High Sierra)
  • Bazel version : 0.11.1 (homebrew)
  • Go rules: 0.11.0

Defined local_repository in WORKSPACE to get external dependencies

Running following command

bazel build //go-app

leads to error

Action failed to execute: java.io.IOException: Cannot run program "/usr/bin/sandbox-exec" (in directory "/TEMP_DIR/PATH"): error=7, Argument list too long

Target //go-app:go-app failed to build

I came across https://docs.bazel.build/versions/master/skylark/lib/Args.html#use_param_file and thought it would fix my issue. Could anyone point me in the direction of how and where to implement this in my BUILD file and make it work? Thanks.

I think it's not in your BUILD file but rather in rules_go.
I'd recommend opening them an issue since AFAIK this is something the rule implementation needs to support.
For example in rules_scala we write the arguments to a file and then pass that file to the worker exactly like how you mention above.
https://github.com/bazelbuild/rules_scala/blob/master/scala/private/rule_impls.bzl#L274