bazelbuild / rules_go

Go rules for Bazel
Apache License 2.0
1.37k stars 649 forks source link

bug(rules/proto): missing attribute attr.importmap #4069

Open tyler-french opened 2 weeks ago

tyler-french commented 2 weeks ago

What version of rules_go are you using?

HEAD

What version of gazelle are you using?

latest

What version of Bazel are you using?

7.2

What did you do?

% bazel build //idl/..:merchant_pb_go_proto 
INFO: Writing tracer profile to '/tmp/bazel_20240827133416_dcvnk'
INFO: Invocation ID: 8ab2bc70-07c3-411a-8444-b89c076859ac
ERROR: /home/user/go-code/idl/../BUILD.bazel:13:20: in @@io_bazel_rules_go//proto:def.bzl%_go_proto_aspect aspect on _go_thriftrw_library rule //idl/code.uber.internal/config/object-config/host-agent:object_config_host_agent_go_thriftrw: 
Traceback (most recent call last):
        File "/home/user/.cache/bazel/_bazel_tfrench/b97476d719d716accead0f2d5b93104f/external/io_bazel_rules_go/proto/def.bzl", line 76, column 25, in _go_proto_aspect_impl
                importmap = attr.importmap,
Error: No attribute 'importmap' in attr. Make sure you declared a rule attribute with this name.
Available attributes: _action_listener, _config_dependencies, _default_deps, _go_context_data, applicable_licenses, aspect_hints, compatible_with, deprecation, deps, exec_compatible_with, exec_properties, expect_failure, features, generator_function, generator_location, generator_name, importpath, name, package, plugins, restricted_to, tags, target_compatible_with, testonly, thrift, thrift_root, thriftrw, toolchains, transitive_configs, visibility
ERROR: Analysis of target '//idl/..host-agent:object_config_host_agent_go_thriftrw' failed
ERROR: Analysis of target '//idl/...:merchant_pb_go_proto' failed; build aborted
INFO: Elapsed time: 4.209s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
INFO: Build Event Protocol files produced successfully.
WARNING:Bazel failed with exit code 1
WARNING:[Errno 2] No such file or directory: '/tmp/tmpwnkmomdi/build_errors.txt'

Here's the rule

go_proto_library(
    name = "merchant_pb_go_proto",
    compilers = [
        "//rules/proto:go_yarpc",
        "@io_bazel_rules_go//proto:gogoslick_grpc",
        "//src/_internal_:go_uber_instrumenter",  # keep
        "//rules/proto:go_uber_validate",
    ],
    importpath = "gogoproto/code.uber.internal/...",
    proto = ":merchant_yelppb_proto",
    visibility = ["//visibility:public"],
    deps = [
        "//src/..:go_default_library",  # keep
    ],
)
dzbarsky commented 2 weeks ago

linking the discussion here https://github.com/bazelbuild/rules_go/pull/4058#issuecomment-2312561310 It sounds like one of the deps elided above is a _go_thriftrw_library, and that's the rule that is missing importmap

fmeum commented 2 weeks ago

@tyler-french Could you check https://github.com/bazelbuild/rules_go/pull/4058#issuecomment-2312746844? If this is really an unexpected dependency, I would consider this failure a feature ;-)