rules_go icon indicating copy to clipboard operation
rules_go copied to clipboard

bug(cgo): go_binary and returns DefaultInfo without executable

Open tyler-french opened this issue 11 months ago • 0 comments

What version of rules_go are you using?

HEAD

What version of gazelle are you using?

0.33.0

What version of Bazel are you using?

6.3.2

Does this issue reproduce with the latest releases of all the above?

Yes

What operating system and processor architecture are you using?

Linux AMD64

Any other potentially useful information about your toolchain?

This issue was introduced in https://github.com/bazelbuild/rules_go/pull/3627

What did you do?

bazel build   //src/.../internal/cgoclient:cgoclient
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
# gazelle:ignore *_test.go

go_library(
    name = "go_default_library",
    srcs = [
        "adaptor.c",
        "adaptor.h",
        "client.go",
        "defs.h",
        "download_blob.go",
        "get_blob_metadata.go",
        "new_client.go",
        "tb_client.h",
        "upload_blob.go",
    ],
    cgo = True,
    ...
)

go_binary(
    name = "cgoclient",
    out = "client",
    embed = [":go_default_library"],
    gc_linkopts = ["-buildmode=c-shared"],
    linkmode = "c-shared",
    visibility = ["//visibility:public"],
)

What did you expect to see?

A successful build

What did you see instead?

Got error:

ERROR: /home/user/.cache/bazel/_bazel_tfrench/b97476d719d716accead0f2d5b93104f/external/org_uber_go_yarpc/encoding/thrift/thriftrw-plugin-yarpc/BUILD.bazel:23:10: in go_binary rule @org_uber_go_yarpc//encoding/thrift/thriftrw-plugin-yarpc:thriftrw-plugin-yarpc: 
/home/user/.cache/bazel/_bazel_tfrench/b97476d719d716accead0f2d5b93104f/external/io_bazel_rules_go/go/private/rules/binary.bzl:154:37: The rule 'go_binary' is executable. It needs to create an executable File and pass it as the 'executable' parameter to the DefaultInfo it returns.
ERROR:

But only after https://github.com/bazelbuild/rules_go/pull/3627

tyler-french avatar Sep 26 '23 18:09 tyler-french