diff options
Diffstat (limited to 'tools/go_stateify')
-rw-r--r-- | tools/go_stateify/defs.bzl | 14 | ||||
-rw-r--r-- | tools/go_stateify/main.go | 10 |
2 files changed, 10 insertions, 14 deletions
diff --git a/tools/go_stateify/defs.bzl b/tools/go_stateify/defs.bzl index a7961c2fb..33267c074 100644 --- a/tools/go_stateify/defs.bzl +++ b/tools/go_stateify/defs.bzl @@ -43,13 +43,13 @@ def _go_stateify_impl(ctx): # Run the stateify command. args = ["-output=%s" % output.path] - args += ["-pkg=%s" % ctx.attr.package] - args += ["-arch=%s" % ctx.attr.arch] + args.append("-pkg=%s" % ctx.attr.package) + args.append("-arch=%s" % ctx.attr.arch) if ctx.attr._statepkg: - args += ["-statepkg=%s" % ctx.attr._statepkg] + args.append("-statepkg=%s" % ctx.attr._statepkg) if ctx.attr.imports: - args += ["-imports=%s" % ",".join(ctx.attr.imports)] - args += ["--"] + args.append("-imports=%s" % ",".join(ctx.attr.imports)) + args.append("--") for src in ctx.attr.srcs: args += [f.path for f in src.files.to_list()] ctx.actions.run( @@ -124,8 +124,8 @@ def go_library(name, srcs, deps = [], imports = [], **kwargs): imports = imports, package = name, arch = select({ - "@bazel_tools//src/conditions:linux_aarch64": "arm64", - "//conditions:default": "amd64", + "@bazel_tools//src/conditions:linux_aarch64": "arm64", + "//conditions:default": "amd64", }), out = name + "_state_autogen.go", ) diff --git a/tools/go_stateify/main.go b/tools/go_stateify/main.go index 47c8ea1d7..7d5d291e6 100644 --- a/tools/go_stateify/main.go +++ b/tools/go_stateify/main.go @@ -90,8 +90,9 @@ func matchtag(tag string, goarch string) bool { return tag == goarch } -// canBuild reports whether we can build this file for target platform by checking file name and build tags. -// The code is derived from the Go source cmd.dist.build.shouldbuild. +// canBuild reports whether we can build this file for target platform by +// checking file name and build tags. The code is derived from the Go source +// cmd.dist.build.shouldbuild. func canBuild(file, goTargetArch string) bool { name := filepath.Base(file) excluded := func(list []string, ok string) bool { @@ -120,11 +121,6 @@ func canBuild(file, goTargetArch string) bool { if p == "" { continue } - code := p - i := strings.Index(code, "//") - if i > 0 { - code = strings.TrimSpace(code[:i]) - } if !strings.HasPrefix(p, "//") { break } |