go: Add runnables (#12110)

This adds support for runnables to Go.

It adds the following tasks:

- `go test $ZED_GO_PACKAGE -run $ZED_SYMBOL`
- `go test $ZED_GO_PACKAGE`
- `go test ./...`
- `go run $ZED_GO_PACKAGE` if it has a `main` function

Release Notes:

- Added built-in Go runnables and tasks that allow users to run Go test
functions, test packages, or run `main` functions.

Demo:



https://github.com/zed-industries/zed/assets/1185253/a6271d80-faf4-466a-bf63-efbec8fe6c35




https://github.com/zed-industries/zed/assets/1185253/92f2b616-7501-463d-b613-1ec1084ae0cd
This commit is contained in:
Thorsten Ball 2024-05-22 07:18:49 +02:00 committed by GitHub
parent e5b9e2044e
commit 8168ec2a28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 104 additions and 3 deletions

View file

@ -0,0 +1,9 @@
(
(function_declaration name: (_) @run
(#match? @run "^Test.*"))
) @go-test
(
(function_declaration name: (_) @run
(#eq? @run "main"))
) @go-main