-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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: Add runnables for Go #12003
Merged
Merged
go: Add runnables for Go #12003
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6c3d35b
Add runnables for Go
anilsenay c9db1dd
Fix subtest names
anilsenay 43952f1
Fix failing workflow jobs
anilsenay 9e65011
Add task names into labels
anilsenay 71ec940
Update pattern to capture the function name as @_name
anilsenay 6ab7614
Combine GoContextProvider after rebase
mrnugget e5eb7f4
Fix Clippy error
mrnugget 196b638
Use whole line and fix label
mrnugget 06e7049
Use eq instead of match for selecting main function
anilsenay 1090579
Update crates/languages/src/go/runnables.scm
anilsenay 6bc9a9c
Update tagging method for go runnables
anilsenay 4c14ac3
Merge branch 'main' of github.com:anilsenay/zed into go-runnables
anilsenay 1db2f07
Update runnable scheme for subtests
anilsenay 13280b6
Fix clippy error
anilsenay 444e262
Merge branch 'main' of github.com:anilsenay/zed into go-runnables
anilsenay 6248a00
Update crates/languages/src/go/runnables.scm
anilsenay 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
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 |
---|---|---|
@@ -1,15 +1,62 @@ | ||
; Functions names start with `Test` | ||
( | ||
( | ||
(function_declaration name: (_) @run | ||
(#match? @run "^Test.*")) | ||
) @_ | ||
(#set! tag go-test) | ||
( | ||
(function_declaration name: (_) @run | ||
(#match? @run "^Test.*")) | ||
) @_ | ||
(#set! tag go-test) | ||
) | ||
|
||
; `t.Run` | ||
( | ||
( | ||
(function_declaration name: (_) @run | ||
(#eq? @run "main")) | ||
) @_ | ||
(#set! tag go-main) | ||
( | ||
(call_expression | ||
function: ( | ||
selector_expression | ||
field: _ @run @_name | ||
(#eq? @_name "Run") | ||
) | ||
arguments: ( | ||
argument_list | ||
. | ||
(interpreted_string_literal) @_subtest_name | ||
. | ||
(func_literal | ||
parameters: ( | ||
parameter_list | ||
(parameter_declaration | ||
name: (identifier) @_param_name | ||
type: (pointer_type | ||
(qualified_type | ||
package: (package_identifier) @_pkg | ||
name: (type_identifier) @_type | ||
(#eq? @_pkg "testing") | ||
(#eq? @_type "T") | ||
) | ||
) | ||
) | ||
) | ||
) @_second_argument | ||
) | ||
) | ||
) @_ | ||
(#set! tag go-subtest) | ||
) | ||
|
||
; Functions names start with `Benchmark` | ||
( | ||
( | ||
(function_declaration name: (_) @run @_name | ||
(#match? @_name "^Benchmark.+")) | ||
) @_ | ||
(#set! tag go-benchmark) | ||
) | ||
|
||
; go run | ||
( | ||
( | ||
(function_declaration name: (_) @run | ||
(#eq? @run "main")) | ||
) @_ | ||
(#set! tag go-main) | ||
) |
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.
Ideally we should add something like
ZED_FILE_DIR
so that you don't have to do this. I'll take care of it.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.
Ok, we'll have ZED_DIRNAME on main real soon: #12245 ; you won't have to set that variable then.