Whenever I run the code using go run main.go, as soon as the code calls the function for creating a table in the sqlite database,I get this error in the command line.
2023/06/02 22:45:23 Binary was compiled with ‘CGO_ENABLED=0’, go-sqlite3 requires cgo to work. This is a stub
What can I do to manually enable cgo, as I thought cgo was enabled automatically?
The cgo tool is enabled by default for native builds on systems where it is expected to work. It is disabled by default when cross-compiling as well as when the CC environment variable is unset and the default C compiler (typically gcc or clang) cannot be found on the system PATH. You can override the default by setting the CGO_ENABLED environment variable when running the go tool: set it to 1 to enable the use of cgo, and to 0 to disable it.