mattn/go-sqlite3

importing go-sqlite hangs my application!!??

tamis-laan opened this issue · 5 comments

given main.go

package main

import (
	"log"
	_ "github.com/mattn/go-sqlite3"
)

func main() {
	log.Println("hello world")
}

running go run -v cmd/main/main.go produces:

github.com/mattn/go-sqlite3
^C⏎ 

the application just hangs...

Removing _ "github.com/mattn/go-sqlite3" allows the application to run again.

go.mod:

module test-go-sqlite

go 1.22.0

require github.com/mattn/go-sqlite3 v1.14.22

This happens to me too.

I'm using Arch Linux, Go 1.22.2 and go-sqlite3 v1.14.22.

Oh, I just read the docs, you need to have CGo enabled: export CGO_ENABLED=1.

If someone has the same problem in the future - just wait a moment. Running your code for the first time just takes a moment because of C code compilation.

I'm also on Arch Linux (on GO 1.23.0) and I realized what is going on after seeing this post. You don't get any information that this is happening, so it looks like something is broken but it's actually working fine and after up to a minute your program will run and then next time you execute it you won't have to wait that long.

Maybe it would be good idea to add this to documentation to not confuse people?

I am also having the same issue, running using go run main.go works just fine and fast. But if I try to run the build version it fails without any error. I am using macOS 15.0 Beta.