Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

go test: i flag may be set only once #1064

Closed
ardan-bkennedy opened this issue Jul 1, 2017 · 3 comments
Closed

go test: i flag may be set only once #1064

ardan-bkennedy opened this issue Jul 1, 2017 · 3 comments

Comments

@ardan-bkennedy
Copy link

I use the "-i" flag on building but this is also being applied to go test.

"go.buildFlags": ["-i"],

It appears "go test" is being run in the background when I open a test file.

This is the error I get at the top of the source file for the package statement:

go test: i flag may be set only once
run "go help test" or "go help testflag" for more information

The help for go test says:

	-i
	    Install packages that are dependencies of the test.
	    Do not run the test.

Can we set flags separately for build and test?

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Jul 4, 2017

We do have a separate setting called testFlags which gets used when running tests via the test commands

Do you have buildOnSave set to "workspace"? That runs go test ./... (but does not actually run the test) using the buildflags. That's causing the problem. Couldn't find any other way to build all files (including test files) in the workspace

From the past couple of releases we have been setting -i by default while building

So you can skip passing it via buildflags to fix the issue you are seeing

Am on a vacation right now. Once am back, will fix the usage of flags so that the double use issue wont occur again

@ardan-bkennedy
Copy link
Author

ardan-bkennedy commented Jul 4, 2017 via email

@ramya-rao-a
Copy link
Contributor

The fix to ignore the -i flag from go.buildFlags (because we add it internally anyway) is out in the latest update (0.6.63) of the Go extension

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants