bazel-contrib / bazel-contrib/rules_go

go package driver - SIGINT/SIGTERM are not detected properly on darwin/arm64

Open
#3,065 0 comments 0 reactions 0 assignees View on GitHub
IDE
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.30

### What version of gazelle are you using?

0.24

### What version of Bazel are you using?

Build label: 5.0.0-homebrew

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

Yes

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

Mac OS X, M1 / arm64

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

### What did you do?
Trying to catch os signals.

The code build fine with bazel, but are not detected by the gopackagedriver config. Note that all other "autocompletes" are working fine, it seems to only apply to the `syscall` package of go.
```go
package main

import (
"os"
"os/signal"
"syscall"
)

func rulesGoTest() {
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
}

```

```
[Trace - 09:30:17.070 AM] Sending request 'textDocument/codeAction - (192)'.
Params: {"textDocument":{"uri":"file:///test.go"},"range":{"start":{"line":10,"character":29},"end":{"line":10,"character":35}},"context":{"diagnostics":[{"range":{"start":{"line":10,"character":29},"end":{"line":10,"character":35}},"message":"SIGINT not declared by package syscall","code":"UndeclaredImportedName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal?utm_source%3Dgopls#UndeclaredImportedName"},"severity":1,"source":"compiler"}],"only":["quickfix"]}}
```

this seems to be arm64 related, we tested on amd64 and the package loads fine.

### What did you expect to see?

IDE to detect the definition of SIGINT

### What did you see instead?
image

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the gopackagedriver configuration issue on Mac OS X arm64 with the shown os/signal and syscall example, then compare it with amd64 behavior. Trace how the Go package driver loads the syscall package and verify that SIGINT and SIGTERM resolve correctly; the IDE should no longer report them as undeclared.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.