Reputation: 1132
Debugging tests to work perfectly but at some point recently something changed, and now it doesn't (perhaps a go version upgrade?).
When I click "debug test" this error message pops up:
The error is: Failed to launch: invalid debug configuration - cannot unmarshal bool into "env" of type string
My launch.json
seems fine (again, this used to work perfectly):
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch test function",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${workspaceFolder}",
"env": {
"LOG_LEVEL": "debug",
"LOG_SQL": "false",
"DATABASE_URL": "postgresql://postgres@localhost:5432/chainlink_test?sslmode=disable",
},
"args": ["-v"]
},
]
}
What could be wrong?
Upvotes: 9
Views: 3578
Reputation: 311
I had the same issue and it turns out it was because of a key/value pair in my settings.json
where the value was a number. I turned it into a string and it worked fine.
See following example of .vscode/settings.json
:
{
"go.testEnvFile": "${workspaceFolder}/.env",
"go.testEnvVars": {
"SOME_TEST_PROPERTY": true
}
}
{
"go.testEnvFile": "${workspaceFolder}/.env",
"go.testEnvVars": {
"SOME_TEST_PROPERTY": "true"
}
}
Upvotes: 1
Reputation: 21
I had the same issue. I have CGO_ENABLED=0
in my global config. However, something is overriding and now expecting a String instead. Try something like this in your launch.json:
{
[...]
"env": {[...] "CGO_ENABLED": "0" [...]},
[...]
},
Upvotes: 2
Reputation: 1
Have the same issue. Did solve by
1. added line "envFile": "${workspaceFolder}/.vscode/server.env" to launch.json
2. added file server.env into ${workspaceFolder}/.vscode/ with following content:
LOG_LEVEL=debug
LOG_SQL=false
DATABASE_URL=...
3. And removed env section from launch.json
Upvotes: 0
Reputation: 2210
Just a guess, but is it because “LOG_SQL” is “false” instead of false (string vs bool), and it’s trying to parse “false” to bool.
Upvotes: 0