bazel-contrib / bazel-contrib/rules_go

Was compiled with... but was linked with...

Open
#3,605 1 comment 5 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.40.0

### What version of gazelle are you using?

0.31.1

### What version of Bazel are you using?

6.1.2

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

Yes

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

Mac OS / M!

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

### What did you do?

Repo: https://github.com/teivah/enola, branch: `web`.

Building a Go project being a gRPC client. The proto rule is described [here](https://github.com/teivah/enola/blob/34a81673797b892f2bb13c2de89a0610abc96fe0/core/lib/BUILD#L43) and contains a dependency to `any_proto` (as the proto [imports](https://github.com/teivah/enola/blob/5c3ddd5b287d8af2a7ab78e23d32a4e9e4ba0e21/core/lib/src/main/java/dev/enola/core/enola_core.proto#L21)) `google/protobuf/any.proto`. Yet, it seems to cause a conflict.

The problem occurs when running the following command:

```
bazelisk run --verbose_failures //web/ui-go
```

### What did you expect to see?

Success

### What did you see instead?

```
link: package conflict error: google.golang.org/protobuf/types/known/anypb: package imports google.golang.org/protobuf/proto
was compiled with: @@gazelle~0.31.1~go_deps~org_golang_google_protobuf//proto:proto
but was linked with: @@org_golang_google_protobuf//proto:proto
See https://github.com/bazelbuild/rules_go/issues/1877.
Target //web/ui-go:ui-go failed to build
INFO: Elapsed time: 35.709s, Critical Path: 1.04s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully
ERROR: Build failed. Not running target
```

### Additional notes

I tried delving into the issue referenced but without success.

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with `bazelisk run --verbose_failures //web/ui-go`, then inspect `core/lib/BUILD` and the imported `core/lib/src/main/java/dev/enola/core/enola_core.proto`. Compare the dependency conflict with rules_go issue 1877; done means the target builds without the compiled-versus-linked package conflict.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.