Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gopackagesdriver: fix interface to work with golangci-lint (#3523) #3524

Merged
merged 2 commits into from
May 24, 2023

Conversation

grampelberg
Copy link
Contributor

@grampelberg grampelberg commented Apr 7, 2023

Unlike gopls which uses file= queries exclusively, golangci-lint uses the more generic go list query syntax. This change allow for file paths not prefixed with file= to be queried correctly.

Additionally, some bugs have been fixed up:

  • Packages with different IDs and identical import paths work now.
  • WKT for protobufs are no longer skipped when the proto wrapper is used.`

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

This PR makes it possible to run golangci-lint and use the bazel source tree, not go list.

  • Expands the supported queries to most of what go list supports. golangci-lint naively passes the patterns through to go/packages which normally delegates to go list. Some examples would be:
    • ./foo
    • /abs/foo
    • ./foo/bar.go
    • ./foo/...
  • Packages with the same import path but separate IDs now work. This allows for multiple targets per package and aliases (rules_go's proto vs google's).
  • WKT for protobufs from rules_go are now included in the result.

Which issues(s) does this PR fix?

Fixes #3523

Other notes for review

See #3552 for the companion PR.

@JamyDev
Copy link
Contributor

JamyDev commented Apr 12, 2023

Had a quick scan over it and didn't immediately see anything concerning. I'm going to give this change a try on Uber's monorepo to see if all our scenarios still work and get back to you.

@grampelberg
Copy link
Contributor Author

@JamyDev thank you! If you run into any issues I'd love to get it updated. I added some debugging statements to golangci-lint for my testing (happy to push a branch if you'd like to see) because that was the easiest way to see the source compilation errors that arise. The easier, but somewhat less illuminating way is to set GL_DEBUG for goanalysis.

@JamyDev
Copy link
Contributor

JamyDev commented Apr 25, 2023

Hey, so I tried applying this as a patch, but was unable to do so. Would you be able to rebase?

@grampelberg
Copy link
Contributor Author

@JamyDev sorry about that! Should be fixed now =)

@JamyDev
Copy link
Contributor

JamyDev commented Apr 26, 2023

Some notes:

  • In the current implementation setting GOPACKAGESDRIVER_BAZEL_QUERY_SCOPE to a bazel target pattern, will limit queries like ./... to that query scope. It seems that in your implementation this will not happen and query the entire module (which in a monorepo is a lot 😅 ) (Check bazelJsonBuilder.localQuery)
  • Not quite yet sure what happened, but we hit a crash with CGo stuff, may be a zig-cc issue, I'll discuss this internally with our team:
INFO: Running command line: bazel-bin/external/io_bazel_rules_go/go/tools/gopackagesdriver/gopackagesdriver_/gopackagesdriver 'file=src/code.uber.internal/devexp/green-keeper/main.go'
Running: [bazel --output_base /home/user/.cache/pkgdrv/0ddf1c72b811bee41d29991c732306ef72553747 info --tool_tag=gopackagesdriver --ui_actions_shown=0]
INFO: Invocation ID: f8c77bc2-378b-461e-acf3-8f5f4f87004e
Running: [bazel --output_base /home/user/.cache/pkgdrv/0ddf1c72b811bee41d29991c732306ef72553747 query --tool_tag=gopackagesdriver --ui_actions_shown=0 --ui_event_filters=-info,-stderr --noshow_progress --order_output=no --output=label --nodep_deps --noimplicit_deps --notool_deps kind("go_library|go_test|go_binary|cff", same_pkg_direct_rdeps("src/path/to/pkg/main.go"))]
Running: [bazel --output_base /home/user/.cache/pkgdrv/0ddf1c72b811bee41d29991c732306ef72553747 build --tool_tag=gopackagesdriver --ui_actions_shown=0 --show_result=0 --build_event_json_file=/tmp/gopackagesdriver_bep_1360650674 --build_event_json_file_path_conversion=no --experimental_convenience_symlinks=ignore --ui_event_filters=-info,-stderr --noshow_progress --aspects=//tools/ide/packagesdriver:aspect.bzl%cff_pkg_info_aspect,@io_bazel_rules_go//go/tools/gopackagesdriver:aspect.bzl%go_pkg_info_aspect --output_groups=go_pkg_driver_json_file,go_pkg_driver_stdlib_json_file,go_pkg_driver_srcs --keep_going //src/path/to/pkg:go_default_library]
ERROR: /home/user/.cache/pkgdrv/0ddf1c72b811bee41d29991c732306ef72553747/external/io_bazel_rules_go/BUILD.bazel:42:7: GoStdlibList external/io_bazel_rules_go/stdlib_/stdlib.pkg.json failed: (Exit 1): builder failed: error executing command (from target @io_bazel_rules_go//:stdlib) bazel-out/k8-opt-exec-2B5CBBC6-ST-1d3589a9f1f7/bin/external/go_sdk/builder_reset/builder stdliblist -sdk external/go_sdk -installsuffix linux_amd64 -sdk external/go_sdk -out ... (remaining 1 argument skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
# runtime/cgo
cgo: C compiler "/home/user/.cache/pkgdrv/0ddf1c72b811bee41d29991c732306ef72553747/sandbox/processwrapper-sandbox/4256/execroot/__main__/external/zig_sdk/tools/x86_64-linux-gnu.2.19/c++" not found: exec: "/home/user/.cache/pkgdrv/0ddf1c72b811bee41d29991c732306ef72553747/sandbox/processwrapper-sandbox/4256/execroot/__main__/external/zig_sdk/tools/x86_64-linux-gnu.2.19/c++": stat /home/user/.cache/pkgdrv/0ddf1c72b811bee41d29991c732306ef72553747/sandbox/processwrapper-sandbox/4256/execroot/__main__/external/zig_sdk/tools/x86_64-linux-gnu.2.19/c++: no such file or directory
stdliblist: error running subcommand external/go_sdk/bin/go: exit status 1
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x54b575]

@grampelberg
Copy link
Contributor Author

In the current implementation setting GOPACKAGESDRIVER_BAZEL_QUERY_SCOPE to a bazel target pattern, will limit queries like ./... to that query scope. It seems that in your implementation this will not happen and query the entire module (which in a monorepo is a lot 😅 ) (Check bazelJsonBuilder.localQuery)

I think that I made that considerably more efficient than it had been with GOPACKAGESDRIVER_BAZEL_QUERY_SCOPE. Previously, we would do a wildcard match that would be pretty expensive. The intent with localQuery is that it will always be a specific path (obviously ... would be the entire sub-tree). Is that kind of specific kind() query still expensive in a large monorepo? My goal was to try and simplify the number of potential knobs you need.

All that said, I'm happy to add it back in.

Not quite yet sure what happened, but we hit a crash with CGo stuff, may be a zig-cc issue

I'd be happy to poke around if you have any way for me to try out an approximation locally.

@JamyDev
Copy link
Contributor

JamyDev commented Apr 26, 2023

Is that kind of specific kind() query still expensive in a large monorepo?

The query itself is fine, but the intent of GOPACKAGESDRIVER_BAZEL_QUERY_SCOPE was to limit the view of the packagesdriver to a specific scope, since building everything would be near impossible. We actually use it to prebuild pkgs.json for any projects the user may be working on.

I'd be happy to poke around if you have any way for me to try out an approximation locally.

Not at this moment, but since Cgo is on my top todo list, I'll have a look this afternoon (PST)

@grampelberg
Copy link
Contributor Author

grampelberg commented Apr 26, 2023

The query itself is fine, but the intent of GOPACKAGESDRIVER_BAZEL_QUERY_SCOPE was to limit the view of the packagesdriver to a specific scope, since building everything would be near impossible.

Should this be a blocker for all queries then? eg, before that if/else tree in queryFromRequests we check it against the scope? That'd block file + package queries though and wouldn't respect the original behavior where query scope was ignored for file queries.

As it sounds like we care less about the query scope and more about the build scope, should we move it down to Build and filter anything out that doesn't match there?

@JamyDev
Copy link
Contributor

JamyDev commented Apr 26, 2023

Hmm that's a good question. file= is a very pointed query, so skipping there may make sense, but in that case you would just not have the QUERY_FILTER. Now let's say you've got a dep outside of your filter, that is used by a package in your filter, it should still resolve (since you have a chance of opening that file in your IDE, or needing to resolve it); so build query may be a bit risky in that case.

I would say let's keep it as much to the original behavior as possible.

@JamyDev
Copy link
Contributor

JamyDev commented Apr 26, 2023

@linzhp any idea why zig-cc wouldn't be included in the execution sandbox when building with the updated aspect in this diff active?

▶ bazel build --sandbox_debug --aspects=@io_bazel_rules_go//go/tools/gopackagesdriver:aspect.bzl%go_pkg_info_aspect --output_groups=go_pkg_driver_json_file,go_pkg_driver_stdlib_json_file,go_pkg_driver_srcs //src/some/pkg:go_default_library

INFO: Writing tracer profile to '/tmp/bazel_20230426231308_f5kju'
INFO: Invocation ID: b884be6c-38b4-43e6-9587-d05e97f25767
INFO: Analyzed target //src/some/pkg:go_default_library (1150 packages loaded, 17273 targets configured).
INFO: Found 1 target...
ERROR: /home/user/.cache/bazel/_bazel_jamy/b97476d719d716accead0f2d5b93104f/external/io_bazel_rules_go/BUILD.bazel:42:7: GoStdlibList external/io_bazel_rules_go/stdlib_/stdlib.pkg.json failed: (Exit 1): process-wrapper failed: error executing command 
  (cd /home/user/.cache/bazel/_bazel_jamy/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/23/execroot/__main__ && \
  exec env - \
    CC=external/zig_sdk/tools/x86_64-linux-gnu.2.19/c++ \
    CGO_CFLAGS='-no-canonical-prefixes -Wno-builtin-macro-redefined -D__DATE__="redacted" -D__TIMESTAMP__="redacted" -D__TIME__="redacted" -include external/zig_sdk/glibc-hacks/fcntl.h -include external/zig_sdk/glibc-hacks/res_search-amd64.h -fno-sanitize=undefined -fno-lto -Wl,-S' \
    CGO_ENABLED=1 \
    CGO_LDFLAGS='-fno-sanitize=undefined -fno-lto -Wl,-S' \
    GOARCH=amd64 \
    GOOS=linux \
    GOPATH='' \
    GOROOT=external/go_sdk \
    GOROOT_FINAL=GOROOT \
    PATH=external/zig_sdk/tools/x86_64-linux-gnu.2.19:/bin:/usr/bin \
    TMPDIR=/tmp \
  /home/user/.cache/bazel/_bazel_jamy/install/e63ada1a9406bff70c6efc9d97c3aeba/process-wrapper '--timeout=0' '--kill_delay=15' '--stats=/home/user/.cache/bazel/_bazel_jamy/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/23/stats.out' bazel-out/k8-opt-exec-2B5CBBC6-ST-1d3589a9f1f7/bin/external/go_sdk/builder_reset/builder stdliblist -sdk external/go_sdk -installsuffix linux_amd64 -sdk external/go_sdk -out bazel-out/k8-fastbuild/bin/external/io_bazel_rules_go/stdlib_/stdlib.pkg.json)
# runtime/cgo
cgo: C compiler "/home/user/.cache/bazel/_bazel_jamy/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/23/execroot/__main__/external/zig_sdk/tools/x86_64-linux-gnu.2.19/c++" not found: exec: "/home/user/.cache/bazel/_bazel_jamy/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/23/execroot/__main__/external/zig_sdk/tools/x86_64-linux-gnu.2.19/c++": stat /home/user/.cache/bazel/_bazel_jamy/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/23/execroot/__main__/external/zig_sdk/tools/x86_64-linux-gnu.2.19/c++: no such file or directory
stdliblist: error running subcommand external/go_sdk/bin/go: exit status 1
Aspect @io_bazel_rules_go//go/tools/gopackagesdriver:aspect.bzl%go_pkg_info_aspect of //src/code.uber.internal/devexp/green-keeper:go_default_library failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 6.595s, Critical Path: 1.89s
INFO: 4 processes: 4 internal.
FAILED: Build did NOT complete successfully

▶ ls -al /home/user/.cache/pkgdrv/0ddf1c72b811bee41d29991c732306ef72553747/sandbox/processwrapper-sandbox/766/execroot/__main__/external/
total 12
drwxr-xr-x 3 jamy user 4096 Apr 26 22:51 .
drwxr-xr-x 4 jamy user 4096 Apr 26 23:08 ..
drwxr-xr-x 5 jamy user 4096 Apr 26 23:08 go_sdk

Here's the diff I applied to the monorepo.

@grampelberg
Copy link
Contributor Author

@JamyDev alright, makes sense. I'll add the query scope into localQuery then. Lemme see what I can do with the docs as well, it was a little challenging for me to figure out what bits and pieces needed to be enabled for this use case.

@linzhp
Copy link
Contributor

linzhp commented Apr 27, 2023

My impression is that the action GoStdlibList uses the C compiler without declaring it in its tools attribute. However, it's unclear to me why the action GoStdlib is able to use it without declaring it. Maybe aspect enforces more strict sandbox?

If that's the case, I am not sure how to pass the C compiler to the tools attribute. What we get from go.cgo_tools.cc_toolchain is a CcToolchainInfo provider, which provides the compiler as a string, not a File object.

@fmeum Any idea?

@fmeum
Copy link
Collaborator

fmeum commented Apr 28, 2023

GoStdlib adds go.crosstool to inputs, which is just go.cgo_tools.cc_toolchain.all_files.to_list(). I am not entirely sure why GoStdlibList needs the compiler, but if it does, that's the set of inputs we should add.

The reason we need this now and didn't before is probably that we pass _cgo_env into _build_stdlib_list_json unconditionally with this PR here - do we really want to do this? It seems that it should at least be gated on the pure setting.

@linzhp
Copy link
Contributor

linzhp commented Apr 28, 2023

GoStdLibList runs go list -json builtin std runtime/cgo, which would preprocess some C code when cgo is enabled.

@grampelberg @JamyDev GoStdLibList needs to have the same input as GoStdLib after cgo is enabled, so the action has access to C compiler and libc headers.

Like Fabian said, do we really need to enable cgo for Go pkg driver? I ran go list -json builtin std runtime/cgo with CGO_ENABLED=1 and CGO_ENABLED=0, the output is not too different. In fact, CGO_ENABLED=0 produces more entries in GoFiles section for some packages, which is fine.

@grampelberg You may consider splitting the part of the PR that is not related to cgo to a different PR, so you can be unblocked for that part.

@JamyDev
Copy link
Contributor

JamyDev commented Apr 28, 2023

do we really need to enable cgo for Go pkg driver?

Maybe we don't need it for stdlib, but we do need it for any of the queries, albeit that may change so it may make sense to support it from the getgo.

@grampelberg
Copy link
Contributor Author

grampelberg commented May 1, 2023

@linzhp you shouldn't see any significant changes in GoFiles, you want to look at CompiledGoFiles. That's where cc preprocesses the go files and compiles them into something that is more usable. Because we don't have that today, golangci-lint is unable to work with anything that has imports from stdlib + cgo. The net library's a great example of this.

Maybe this is where you're going, but does it make sense to disable cgo entirely for packages driver? For my use case, I just need some source that can compile. The non-exported functionality doesn't impact me.

Separately, I'll get the changes split into stdlib + cgo and driver changes. That's a great suggestion.

@linzhp
Copy link
Contributor

linzhp commented May 1, 2023

I ran go list -f '{{.CompiledGoFiles}}' builtin std runtime/cgo with both CGO_ENABLED=1 and CGO_ENABLED=0 on Linux, both returned empty lists for all packages. Are you sure that's what golangci-lint wants?

@grampelberg
Copy link
Contributor Author

@linzhp yup! You also need -compiled=true.

@linzhp
Copy link
Contributor

linzhp commented May 2, 2023

I see the difference now. Thanks for pointing out. OK, let's split the PR, make GoStdlibList take the same list of input as GoStdlib and iterate from there. There are some rough edges that I need to get help from other people to make GoStdlibList work with hermetic cc toolchain.

does it make sense to disable cgo entirely for packages driver?

Worst case, we can disable cgo for stdlib but we should still be able to enable cgo for other packages.

@grampelberg
Copy link
Contributor Author

Worst case, we can disable cgo for stdlib but we should still be able to enable cgo for other packages.

You're right, I was suggesting disabling it for stdlib.

make GoStdlibList take the same list of input as GoStdlib and iterate from there

I'm not sure I understand what you're suggesting here?

@linzhp
Copy link
Contributor

linzhp commented May 2, 2023

I mean something like this on top of your change:

diff --git a/go/private/actions/stdlib.bzl b/go/private/actions/stdlib.bzl
index 1cb953d4..fedb317d 100644
--- a/go/private/actions/stdlib.bzl
+++ b/go/private/actions/stdlib.bzl
@@ -70,7 +70,7 @@ def _build_stdlib_list_json(go, env):
     args.add("-out", out)
 
     go.actions.run(
-        inputs = go.sdk_files,
+        inputs = go.sdk_files + go.crosstool,
         outputs = [out],
         mnemonic = "GoStdlibList",
         executable = go.toolchain._builder,

So go list can access the hermetic C compiler in Bazel sandbox.

@grampelberg
Copy link
Contributor Author

@linzhp I see! If you can point me in the direction of a way that I can test hermetic C compilers locally, I'd be happy to iterate towards something that works there.

In the meantime, this has been split into two PRs, see #3552 for the companion PR.

@JamyDev
Copy link
Contributor

JamyDev commented May 4, 2023

Sorry for the delay here, I was able to get it functioning with your latest changes, so this is good to go

go/tools/gopackagesdriver/aspect.bzl Outdated Show resolved Hide resolved
@fmeum
Copy link
Collaborator

fmeum commented May 4, 2023

Looks good to me, but I don't understand the details. @linzhp Could you merge this?

@JamyDev
Copy link
Contributor

JamyDev commented May 4, 2023

I'll work with @linzhp to merge this, still playing around with the other diff a bit.

@grampelberg
Copy link
Contributor Author

@JamyDev back to our conversation about GOPACKAGESDRIVER_BAZEL_QUERY_SCOPE, the only way I can look to match the behavior with localQuery is to do something like filter(//foo/bar/baz, kind(go_library, //my_other_thing/...)). That feels like it is moving in the wrong direction, especially because filter doesn't work quite the same as deps(//foo/bar/baz) in packageQuery.

@kev-the-dev
Copy link

Your PR summary mentioned my issue #3554... did you mean #3552?

@grampelberg
Copy link
Contributor Author

@kev-the-dev I did, sorry about that!

@grampelberg
Copy link
Contributor Author

I believe that this is ready to go, any changes I can make to get it merged?

@linzhp linzhp enabled auto-merge (squash) May 16, 2023 04:47
…d#3523)

Unlike gopls which uses `file=` queries exclusively, golangci-lint uses
the more generic `go list` query syntax. This change allow for file
paths not prefixed with `file=` to be queried correctly.

Additionally, some bugs have been fixed up:
- Packages with different IDs and identical import paths work now.
- WKT for protobufs are no longer skipped when the proto wrapper is
  used.`

Change-Id: Ie1fc571f52cf5f6d1ff94b0aea2c05c06bb4be4e
auto-merge was automatically disabled May 16, 2023 14:38

Head branch was pushed to by a user without write access

@linzhp linzhp merged commit b84cd75 into bazelbuild:master May 24, 2023
2 checks passed
@grampelberg grampelberg deleted the thomas/packages-driver branch May 24, 2023 21:48
renovate bot added a commit to kreempuff/rules_unreal_engine that referenced this pull request Jun 22, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [io_bazel_rules_go](https://togithub.com/bazelbuild/rules_go) |
http_archive | minor | `v0.39.1` -> `v0.40.0` |

---

### ⚠ Dependency Lookup Warnings ⚠

Warnings were logged while processing this repo. Please check the
Dependency Dashboard for more information.

---

### Release Notes

<details>
<summary>bazelbuild/rules_go</summary>

###
[`v0.40.0`](https://togithub.com/bazelbuild/rules_go/releases/tag/v0.40.0)

[Compare
Source](https://togithub.com/bazelbuild/rules_go/compare/v0.39.1...v0.40.0)

#### What's Changed

- Revert "Add automatic platform detection from inbound crosstool_top a…
by [@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3468
- bzlmod: Add dedicated documentation by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3519
- Create TEST_SHARD_STATUS_FILE when sharding tests by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3547
- Move CI flags to .bazelrc and fix BwoB build by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3551
- Re-enable go_path_test on RBE by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[bazelbuild/rules_go#3539
- nogo: provide usage doc by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[bazelbuild/rules_go#3534
- respect global strip config by
[@&#8203;malt3](https://togithub.com/malt3) in
[bazelbuild/rules_go#3527
- stdliblist: return generated files by
[@&#8203;grampelberg](https://togithub.com/grampelberg) in
[bazelbuild/rules_go#3552
- Fix formatting in nogo usage doc by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[bazelbuild/rules_go#3557
- Fix `goexperiment.*` build tags by
[@&#8203;lbcjbb](https://togithub.com/lbcjbb) in
[bazelbuild/rules_go#3556
- Remove tests for `go_path`'s `link` mode by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3565
- Fix tests with `--incompatible_disable_starlark_host_transitions` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3560
- Create empty `.go` file in a random location by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3566
- gopackagesdriver: fix interface to work with golangci-lint
([#&#8203;3523](https://togithub.com/bazelbuild/rules_go/issues/3523))
by [@&#8203;grampelberg](https://togithub.com/grampelberg) in
[bazelbuild/rules_go#3524
- Fix typo in load statement for bzlmod docs by
[@&#8203;Sovietaced](https://togithub.com/Sovietaced) in
[bazelbuild/rules_go#3570
- context: remove unused import by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[bazelbuild/rules_go#3571
- docs: Mention `use_repo` automation by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3573
- Test basic-gazelle example with incompatible flags by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3575
- go_sdk extension: create `go_host_compatible_sdk` repository by
[@&#8203;ylecornec](https://togithub.com/ylecornec) in
[bazelbuild/rules_go#3543
- docs: Mention that `gazelle:prefix` can be replaced by `go.mod` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3577
- go_download_sdk: apply extraction workaround to zips on non-windows
OSs by [@&#8203;jayconrod](https://togithub.com/jayconrod) in
[bazelbuild/rules_go#3563
- Fix `go_download_sdk` with Bazel dev versions by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3580
- Implement //nolint parsing similar to golangci-lint by
[@&#8203;patrickmscott](https://togithub.com/patrickmscott) in
[bazelbuild/rules_go#3562

#### New Contributors

- [@&#8203;bricedp](https://togithub.com/bricedp) made their first
contribution in
[bazelbuild/rules_go#3512
- [@&#8203;patrickmscott](https://togithub.com/patrickmscott) made their
first contribution in
[bazelbuild/rules_go#3528
- [@&#8203;grampelberg](https://togithub.com/grampelberg) made their
first contribution in
[bazelbuild/rules_go#3552
- [@&#8203;Sovietaced](https://togithub.com/Sovietaced) made their first
contribution in
[bazelbuild/rules_go#3570
- [@&#8203;ylecornec](https://togithub.com/ylecornec) made their first
contribution in
[bazelbuild/rules_go#3543

**Full Changelog**:
bazelbuild/rules_go@v0.39.1...v0.40.0

#### `WORKSPACE` code

load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive")

    http_archive(
        name = "io_bazel_rules_go",
sha256 =
"bfc5ce70b9d1634ae54f4e7b495657a18a04e0d596785f672d35d5f505ab491a",
        urls = [

"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.40.0/rules_go-v0.40.0.zip",

"https://github.com/bazelbuild/rules_go/releases/download/v0.40.0/rules_go-v0.40.0.zip",
        ],
    )

load("@&#8203;io_bazel_rules_go//go:deps.bzl", "go_register_toolchains",
"go_rules_dependencies")

    go_rules_dependencies()

    go_register_toolchains(version = "1.20.5")

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/kreempuff/rules_unreal_engine).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMzEuMCIsInVwZGF0ZWRJblZlciI6IjM1LjEzMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
renovate bot added a commit to cgrindel/rules_swift_package_manager that referenced this pull request Jun 23, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [io_bazel_rules_go](https://togithub.com/bazelbuild/rules_go) |
http_archive | minor | `v0.39.1` -> `v0.40.0` |

---

### Release Notes

<details>
<summary>bazelbuild/rules_go</summary>

###
[`v0.40.0`](https://togithub.com/bazelbuild/rules_go/releases/tag/v0.40.0)

[Compare
Source](https://togithub.com/bazelbuild/rules_go/compare/v0.39.1...v0.40.0)

#### What's Changed

- Revert "Add automatic platform detection from inbound crosstool_top a…
by [@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3468
- bzlmod: Add dedicated documentation by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3519
- Create TEST_SHARD_STATUS_FILE when sharding tests by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3547
- Move CI flags to .bazelrc and fix BwoB build by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3551
- Re-enable go_path_test on RBE by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[bazelbuild/rules_go#3539
- nogo: provide usage doc by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[bazelbuild/rules_go#3534
- respect global strip config by
[@&#8203;malt3](https://togithub.com/malt3) in
[bazelbuild/rules_go#3527
- stdliblist: return generated files by
[@&#8203;grampelberg](https://togithub.com/grampelberg) in
[bazelbuild/rules_go#3552
- Fix formatting in nogo usage doc by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[bazelbuild/rules_go#3557
- Fix `goexperiment.*` build tags by
[@&#8203;lbcjbb](https://togithub.com/lbcjbb) in
[bazelbuild/rules_go#3556
- Remove tests for `go_path`'s `link` mode by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3565
- Fix tests with `--incompatible_disable_starlark_host_transitions` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3560
- Create empty `.go` file in a random location by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3566
- gopackagesdriver: fix interface to work with golangci-lint
([#&#8203;3523](https://togithub.com/bazelbuild/rules_go/issues/3523))
by [@&#8203;grampelberg](https://togithub.com/grampelberg) in
[bazelbuild/rules_go#3524
- Fix typo in load statement for bzlmod docs by
[@&#8203;Sovietaced](https://togithub.com/Sovietaced) in
[bazelbuild/rules_go#3570
- context: remove unused import by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[bazelbuild/rules_go#3571
- docs: Mention `use_repo` automation by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3573
- Test basic-gazelle example with incompatible flags by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3575
- go_sdk extension: create `go_host_compatible_sdk` repository by
[@&#8203;ylecornec](https://togithub.com/ylecornec) in
[bazelbuild/rules_go#3543
- docs: Mention that `gazelle:prefix` can be replaced by `go.mod` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3577
- go_download_sdk: apply extraction workaround to zips on non-windows
OSs by [@&#8203;jayconrod](https://togithub.com/jayconrod) in
[bazelbuild/rules_go#3563
- Fix `go_download_sdk` with Bazel dev versions by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3580
- Implement //nolint parsing similar to golangci-lint by
[@&#8203;patrickmscott](https://togithub.com/patrickmscott) in
[bazelbuild/rules_go#3562

#### New Contributors

- [@&#8203;bricedp](https://togithub.com/bricedp) made their first
contribution in
[bazelbuild/rules_go#3512
- [@&#8203;patrickmscott](https://togithub.com/patrickmscott) made their
first contribution in
[bazelbuild/rules_go#3528
- [@&#8203;grampelberg](https://togithub.com/grampelberg) made their
first contribution in
[bazelbuild/rules_go#3552
- [@&#8203;Sovietaced](https://togithub.com/Sovietaced) made their first
contribution in
[bazelbuild/rules_go#3570
- [@&#8203;ylecornec](https://togithub.com/ylecornec) made their first
contribution in
[bazelbuild/rules_go#3543

**Full Changelog**:
bazelbuild/rules_go@v0.39.1...v0.40.0

#### `WORKSPACE` code

load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive")

    http_archive(
        name = "io_bazel_rules_go",
sha256 =
"bfc5ce70b9d1634ae54f4e7b495657a18a04e0d596785f672d35d5f505ab491a",
        urls = [

"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.40.0/rules_go-v0.40.0.zip",

"https://github.com/bazelbuild/rules_go/releases/download/v0.40.0/rules_go-v0.40.0.zip",
        ],
    )

load("@&#8203;io_bazel_rules_go//go:deps.bzl", "go_register_toolchains",
"go_rules_dependencies")

    go_rules_dependencies()

    go_register_toolchains(version = "1.20.5")

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/cgrindel/rules_swift_package_manager).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMzEuMCIsInVwZGF0ZWRJblZlciI6IjM1LjEzMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot added a commit to cgrindel/bazel-starlib that referenced this pull request Jun 23, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [io_bazel_rules_go](https://togithub.com/bazelbuild/rules_go) |
http_archive | minor | `v0.39.1` -> `v0.40.0` |

---

### Release Notes

<details>
<summary>bazelbuild/rules_go</summary>

###
[`v0.40.0`](https://togithub.com/bazelbuild/rules_go/releases/tag/v0.40.0)

[Compare
Source](https://togithub.com/bazelbuild/rules_go/compare/v0.39.1...v0.40.0)

#### What's Changed

- Revert "Add automatic platform detection from inbound crosstool_top a…
by [@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3468
- bzlmod: Add dedicated documentation by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3519
- Create TEST_SHARD_STATUS_FILE when sharding tests by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3547
- Move CI flags to .bazelrc and fix BwoB build by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3551
- Re-enable go_path_test on RBE by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[bazelbuild/rules_go#3539
- nogo: provide usage doc by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[bazelbuild/rules_go#3534
- respect global strip config by
[@&#8203;malt3](https://togithub.com/malt3) in
[bazelbuild/rules_go#3527
- stdliblist: return generated files by
[@&#8203;grampelberg](https://togithub.com/grampelberg) in
[bazelbuild/rules_go#3552
- Fix formatting in nogo usage doc by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[bazelbuild/rules_go#3557
- Fix `goexperiment.*` build tags by
[@&#8203;lbcjbb](https://togithub.com/lbcjbb) in
[bazelbuild/rules_go#3556
- Remove tests for `go_path`'s `link` mode by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3565
- Fix tests with `--incompatible_disable_starlark_host_transitions` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3560
- Create empty `.go` file in a random location by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3566
- gopackagesdriver: fix interface to work with golangci-lint
([#&#8203;3523](https://togithub.com/bazelbuild/rules_go/issues/3523))
by [@&#8203;grampelberg](https://togithub.com/grampelberg) in
[bazelbuild/rules_go#3524
- Fix typo in load statement for bzlmod docs by
[@&#8203;Sovietaced](https://togithub.com/Sovietaced) in
[bazelbuild/rules_go#3570
- context: remove unused import by
[@&#8203;sluongng](https://togithub.com/sluongng) in
[bazelbuild/rules_go#3571
- docs: Mention `use_repo` automation by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3573
- Test basic-gazelle example with incompatible flags by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3575
- go_sdk extension: create `go_host_compatible_sdk` repository by
[@&#8203;ylecornec](https://togithub.com/ylecornec) in
[bazelbuild/rules_go#3543
- docs: Mention that `gazelle:prefix` can be replaced by `go.mod` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3577
- go_download_sdk: apply extraction workaround to zips on non-windows
OSs by [@&#8203;jayconrod](https://togithub.com/jayconrod) in
[bazelbuild/rules_go#3563
- Fix `go_download_sdk` with Bazel dev versions by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3580
- Implement //nolint parsing similar to golangci-lint by
[@&#8203;patrickmscott](https://togithub.com/patrickmscott) in
[bazelbuild/rules_go#3562

#### New Contributors

- [@&#8203;bricedp](https://togithub.com/bricedp) made their first
contribution in
[bazelbuild/rules_go#3512
- [@&#8203;patrickmscott](https://togithub.com/patrickmscott) made their
first contribution in
[bazelbuild/rules_go#3528
- [@&#8203;grampelberg](https://togithub.com/grampelberg) made their
first contribution in
[bazelbuild/rules_go#3552
- [@&#8203;Sovietaced](https://togithub.com/Sovietaced) made their first
contribution in
[bazelbuild/rules_go#3570
- [@&#8203;ylecornec](https://togithub.com/ylecornec) made their first
contribution in
[bazelbuild/rules_go#3543

**Full Changelog**:
bazelbuild/rules_go@v0.39.1...v0.40.0

#### `WORKSPACE` code

load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive")

    http_archive(
        name = "io_bazel_rules_go",
sha256 =
"bfc5ce70b9d1634ae54f4e7b495657a18a04e0d596785f672d35d5f505ab491a",
        urls = [

"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.40.0/rules_go-v0.40.0.zip",

"https://github.com/bazelbuild/rules_go/releases/download/v0.40.0/rules_go-v0.40.0.zip",
        ],
    )

load("@&#8203;io_bazel_rules_go//go:deps.bzl", "go_register_toolchains",
"go_rules_dependencies")

    go_rules_dependencies()

    go_register_toolchains(version = "1.20.5")

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/cgrindel/bazel-starlib).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMzEuMCIsInVwZGF0ZWRJblZlciI6IjM1LjEzMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
tingilee pushed a commit to tingilee/rules_go that referenced this pull request Jul 19, 2023
…d#3523) (bazelbuild#3524)

Unlike gopls which uses `file=` queries exclusively, golangci-lint uses
the more generic `go list` query syntax. This change allow for file
paths not prefixed with `file=` to be queried correctly.

Additionally, some bugs have been fixed up:
- Packages with different IDs and identical import paths work now.
- WKT for protobufs are no longer skipped when the proto wrapper is
  used.`

Change-Id: Ie1fc571f52cf5f6d1ff94b0aea2c05c06bb4be4e

Co-authored-by: Thomas Rampelberg <thomas.rampelberg@airbnb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gopackagesdriver doesn't work with golangci-lint
5 participants