logo

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 didn’t adhere to the environment variables CC and CGO_ENABLED.

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 compiler as well.