joriszwart.nl

I code dreams™

Golang

Problem

I had some trouble using go-sqlite3 while running tests in Visual Studio Code and the Go-extension. The Go compiler doesn’t adhere to the environment variables CC and CGO_ENABLED in launch.json.

Solution

Open the global settings.json using the Command Palette (CTRL + SHIFT + P) and add:

"go.testEnvVars": {
  "CGO_ENABLED": "1",
  "CC": "x86_64-w64-mingw32-gcc.exe"
}

This shows using the Mingw (installed using Cygwin) compiler as well.