golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.78k stars 727 forks source link

Support go.testBinary to allow use of wrappers for testing #3404

Closed danhawkins closed 3 weeks ago

danhawkins commented 1 month ago

Add support for go.testBinary setting to allow for wrappers for tests

As mentioned in #3340 there are times when using go to execute tests is not possible, a wrapper is needed, this PR adds an new configuration go.testBinary where you would replace the go in go test with your declared binary

Fixes #3340

danhawkins commented 1 month ago

I could do some help with this PR on the testing side, if anybody is interested, keen to hear if this approach works also with the maintainers.

gopherbot commented 1 month ago

This PR (HEAD: 685bd8b41cd470fe98533e78e7530df84ef8e986) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/vscode-go/+/588515.

Important tips:

gopherbot commented 1 month ago

Message from Gopher Robot:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/588515. After addressing review feedback, remember to publish your drafts!

gopherbot commented 1 month ago

Message from Gopher Robot:

Patch Set 1:

Congratulations on opening your first change. Thank you for your contribution!

Next steps: A maintainer will review your change and provide feedback. See https://go.dev/doc/contribute#review for more info and tips to get your patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be surprising to people new to the project. The careful, iterative review process is our way of helping mentor contributors and ensuring that their contributions have a lasting impact.


Please don’t reply on this GitHub thread. Visit golang.org/cl/588515. After addressing review feedback, remember to publish your drafts!

danhawkins commented 3 weeks ago

Closing the PR as the problem can be solved with

  "go.alternateTools": {
    "go": "${workspaceFolder}/test-script.sh"
  },

test-script.sh

#!/bin/sh

if [ $1 = 'test' ]
then
    encore $@ --no-color
else
    go $@
fi

However when using this approach from https://discord.com/channels/814482502336905216/1237684243606536293/1245754619141820428