fix(gopackagesdriver): Improve wildcard package query matching
What type of PR is this?
Bug fix
What does this PR do? Why is it needed?
Improve wildcard package loading (./something/...) when using a custom bazelQueryScope e.g. //.... Currently, the queryFromRequests transformation results in a query like:
bazel query "kind(\"^(go_library) rule$\", attr(importpath, \"^./something(/.+)?$\", deps(//...)))"
which fails to return any results due to the ^ start of string matching. This PR also aligns the behaviour more closely to the "non wild card" behaviour (see) by omitting the ^.
When using go outside bazel, the following query is valid syntax and correctly loads all the packages under ./something/:
package.Load(cfg, "./something/...")
Which issues(s) does this PR fix?
No issue
Other notes for review
What does the actual kind look like in that case that it doesn't match the start of string?
@fmeum all the returned results without "^" start with // for example:
//something/foo/bar/foobar:baz
//something/foo:bar
//something/bar/foo:baz
I'm not sure if this is what you mean by "kind"
Thanks, I thought this also affected the usage of ^ in the kind part of the query, but it doesn't.