bazel-contrib / bazel-contrib/rules_go

`go_proto_library` output is not reproducible on different host platforms

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

Description

### What version of rules_go are you using?

0.48.1

### What version of gazelle are you using?

0.37.0

### What version of Bazel are you using?

7.2.1

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

Those are the latest releases as of time of writing.

### What operating system and processor architecture are you using?

Tried on Darwin/Linux, resp:

```
$ uname -sm
Darwin arm64
```

```
$ uname -sm
Linux x86_64
```

### Any other potentially useful information about your toolchain?

See reproducer: https://github.com/Illedran/go_cross_reproducible

### What did you do?

In the reproducer: `bazel build //:cross`. Inspecting the output of `go_proto_library`, in the transition triggered by `go_cross_binary`:
```
# Darwin
$ md5 bazel-out/darwin_arm64-fastbuild-ST-2c62b798ec6c/bin/proto/proto.a
MD5 (bazel-out/darwin_arm64-fastbuild-ST-2c62b798ec6c/bin/proto/proto.a) = c12605aa69aea711f341eab796689bff

# Linux
$ md5sum bazel-out/k8-fastbuild-ST-2c62b798ec6c/bin/proto/proto.a
d3fd7a4e36f011b221e743132ff41c03 bazel-out/k8-fastbuild-ST-2c62b798ec6c/bin/proto/proto.a
```

A diff of those archives using diffoscope can be seen at https://try.diffoscope.org/xhsafcfsqkpf.html - but it's actually easier to see the problem on the final resulting binaries https://try.diffoscope.org/tpbcfezvbhvh.html, where it appears that part of path that is dependant on the host platform "leaks" into the final binary.

---

Conversation in Bazel's Slack: https://bazelbuild.slack.com/archives/CDBP88Z0D/p1720078099231259

Contributor guide

Open the contributing guide

Research direction

Start with the linked go_cross_reproducible reproducer and run `bazel build //:cross` on Darwin arm64 and Linux x86_64. Compare the `go_proto_library` archives and final binaries with the linked diffoscope reports; done means host-platform paths no longer affect the generated outputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.