rules_go icon indicating copy to clipboard operation
rules_go copied to clipboard

Introduce `["all"]` scope for nogo

Open fmeum opened this issue 10 months ago • 7 comments

What type of PR is this?

Feature

What does this PR do? Why is it needed?

Which issues(s) does this PR fix?

Work towards #4241

Other notes for review

fmeum avatar Feb 16 '25 22:02 fmeum

@fionera Could you give this a try as well? I'm not sure how usable it is though, the first nogo finding is:

nogo: errors found by nogo during build-time code analysis:
external/gazelle~~go_deps~org_golang_x_sys/unix/syscall_darwin.go:584:19: declaration of "err" shadows declaration at line 578 (shadow)
external/gazelle~~go_deps~org_golang_x_sys/unix/syscall_darwin.go:593:19: declaration of "err" shadows declaration at line 578 (shadow)
external/gazelle~~go_deps~org_golang_x_sys/unix/syscall_unix.go:117:28: possible misuse of unsafe.Pointer (unsafeptr)
external/gazelle~~go_deps~org_golang_x_sys/unix/syscall_unix.go:159:9: possible misuse of unsafe.Pointer (unsafeptr)
external/gazelle~~go_deps~org_golang_x_sys/unix/sysvshm_unix.go:32:28: possible misuse of unsafe.Pointer (unsafeptr)

How are you dealing with this amount of warnings in basic deps?

fmeum avatar Feb 17 '25 08:02 fmeum

@fmeum Works fine, except that our excludes are not working anymore and I only just noticed. :smile: Because of the new naming of bzlmod didn't appear as issue before this patch. Since you asked how we are dealing with them, we have a fairly big exception list https://github.com/monogon-dev/monogon/blob/main/build/analysis/BUILD.bazel Is there motivation to replace the bzlmod repo name with the actual go dependency name for these? Or is that not really possible because of the way the excludes work?

fionera avatar Feb 18 '25 03:02 fionera

Have you tried the excludes attribute of the nogo tag? It accepts labels, not paths, and should this work with Bzlmod.

fmeum avatar Feb 18 '25 07:02 fmeum

That would exclude them completely. I only want to exclude them from specific nogo analyzers.

fionera avatar Feb 21 '25 02:02 fionera

Could you file a separate issue for that? We probably do need to change how we identify files in the nogo config

fmeum avatar Feb 21 '25 19:02 fmeum

Opened https://github.com/bazel-contrib/rules_go/issues/4284 for it

fionera avatar Feb 25 '25 06:02 fionera

Any plans on merging this?

fionera avatar Nov 20 '25 14:11 fionera