bazel-contrib / bazel-contrib/rules_go

go_binary: don't concatenate headers in c-archive, c-shared link modes

Open
#2,131 0 comments 0 reactions 0 assignees View on GitHub
bug cgo
Dominant language
Go
Stars
1.5k
Forks
760
Avg merge
1d 11h
Merged PRs (30d)
12

Description

The `go_binary_c_archive_shared` macro declares several additional targets around `go_binary` rules with `linkmode = "c-shared"` or `"c-archive"`. One of these gathers all the .h files in the `cgo_exports` output group and concatenates them into a single header.

This is not what the Go command does. Only the export header for the `main` package should be visible. Incorporating headers from other packages adds confusion.

Contributor guide

Open the contributing guide

Research direction

Start with the go_binary_c_archive_shared macro and its go_binary rules using linkmode = "c-shared" or "c-archive". Inspect how the cgo_exports output group is gathered and compare it with the Go command's export-header behavior; done means only the main package's export header is visible, without concatenated headers from other packages.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.