Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importing go-sqlite hangs my application!!?? #1228

Open
tamis-laan opened this issue Mar 18, 2024 · 4 comments
Open

importing go-sqlite hangs my application!!?? #1228

tamis-laan opened this issue Mar 18, 2024 · 4 comments

Comments

@tamis-laan
Copy link

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
@itaranto
Copy link

itaranto commented May 9, 2024

This happens to me too.

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

@itaranto
Copy link

itaranto commented May 9, 2024

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

@Neidz
Copy link

Neidz commented Aug 26, 2024

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?

@arikchakma

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants