Skip to main content

An error occurs when connecting to sqlite3: go-sqlite3 requires cgo to work. This is a stub

Error message:

register db Ping default, Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub

Windows solution

  1. Create new environment variables

  1. A new error occurs

Error message:

Failed to build the application: # runtime/cgo
cgo: C compiler “ gcc ” not found: exec: “gcc”: executable file not found in %PATH%
  1. Install GCC

3.1 Enter Sqlite3 official website:https://github.com/mattn/go-sqlite3

3.2 Find the Windows section

3.2 Click the download link

3.3 Download one according to your preference

3.4 Installation

So far it has been successfully solved! ! !