-
-
Notifications
You must be signed in to change notification settings - Fork 666
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
go/tools/gopackagesdriver: add automatic target detection #2932
Merged
+437
−174
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
5d9f106
go/tools/gopackagesdriver: add automatic target detection
steeve 576729d
workspace: add vscode configuration
steeve a36675c
go/tools/gopackagesdriver: don't use //... universe scope for file qu…
steeve baba0dd
go/tools/gopackagesdriver: add GOPACKAGESDRIVER_BAZEL_QUERY_SCOPE
steeve b2b33b3
Allow querying external dependencies with importpath
steeve 646e311
go/tools/gopackagesdriver: fetch output_base from bazel info
steeve 3d2175b
go/tools/gopackagesdriver: pull source files and return stdlib by def…
steeve 2071919
Fix typo
steeve 1d4e937
Fix formatting
steeve 3c96e2c
Enable queries on package registry
steeve 6a7a1e6
Move some utiliy functions to the utils file
steeve cd8d554
Remove unsued bazel struct members
steeve a2f3225
Don't match only by string prefix when matching /...
steeve d3f0ed0
Stdlib files are relative to the output_base, not execroot
steeve 503ed0e
Simpler error checking for bazel errors
steeve 2d323ab
Don't use some on bazel query for package
steeve 42013df
CHeck for empty labels when trying to build a target
steeve ec895a3
Honor build tags when listing files
steeve 87c69ed
Properly match full and child importpaths
steeve 64ba983
Add a comment telling why we exit(0)
steeve 0def12d
Better regexp for importpath matching
steeve 0703743
Don't append empty bazel queries to bazel build
steeve ddf8e68
Make completion on test files work
steeve 165e959
Handle tests that don't have embedded libraries
steeve File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
// See http://go.microsoft.com/fwlink/?LinkId=827846 | ||
// for the documentation about the extensions.json format | ||
"recommendations": [ | ||
"bazelbuild.vscode-bazel", | ||
"golang.go", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"files.trimTrailingWhitespace": true, | ||
"files.insertFinalNewline": true, | ||
"go.goroot": "${workspaceFolder}/bazel-${workspaceFolderBasename}/external/go_sdk", | ||
"go.toolsEnvVars": { | ||
"GOPACKAGESDRIVER": "${workspaceFolder}/tools/gopackagesdriver.sh" | ||
}, | ||
"go.enableCodeLens": { | ||
"references": false, | ||
"runtest": false | ||
}, | ||
"gopls": { | ||
"formatting.gofumpt": true, | ||
"formatting.local": "github.com/bazelbuild/rules_go", | ||
"ui.completion.usePlaceholders": true, | ||
"ui.semanticTokens": true, | ||
"ui.codelenses": { | ||
"gc_details": false, | ||
"regenerate_cgo": false, | ||
"generate": false, | ||
"test": false, | ||
"tidy": false, | ||
"upgrade_dependency": false, | ||
"vendor": false | ||
}, | ||
}, | ||
"go.useLanguageServer": true, | ||
"go.buildOnSave": "off", | ||
"go.lintOnSave": "off", | ||
"go.vetOnSave": "off", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's better to find the
go_library
target in the same directory as thego_test
with regular (not generated) src files. When Gazelle generatego_test
withoutembed
, it puts the:go_default_library
indeps
. So we need that fromdeps
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is, as I try to let each target generate their own files, so that the analysis graph remains stable and the resource usage is kept "low".
If the
go_library
is indeps
, then things will work as expected without all this code. The hard part is handlingembed
. Consuming the "augmented" version requires consumingGoArchiveData.direct
, so we can't use theTargets
. Hence this piece.