问题
I searched in many web pages to find what phrase exact should I place in settings.json
in VS Code Golang extension (released by Microsoft) to add a build flag (in my case, race detector)?
I added:
"go.buildFlags": ["-race"],
in extension's settings.json
but still when debugging, in a function that definitely generates a race condition, the debugging console does not denote something like:
Found 1 data race(s)
which the go compiler usually indicates when executing the same file via
go run -race file.go
回答1:
adding this line in settings.json
"go.testFlags": ["-race"]
works for me
来源:https://stackoverflow.com/questions/56668273/how-to-enable-race-detector-for-golang-in-visual-studio-code