Skip to content
New issue

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

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

Already on GitHub? # to your account

Hanging when including the package on my main file. Any help? #451

Closed
AlexandreRoba opened this issue Aug 16, 2017 · 8 comments
Closed

Hanging when including the package on my main file. Any help? #451

AlexandreRoba opened this issue Aug 16, 2017 · 8 comments

Comments

@AlexandreRoba
Copy link

AlexandreRoba commented Aug 16, 2017

Hi all,

I'm trying to open a connection using the driver but it hangs the all main function when the package is imported on my main function.

I'm running Go :
go version go1.8.3 darwin/amd64
On a mac os X:
System Version: macOS 10.12.6 (16G29)
Kernel Version: Darwin 16.7.0
Boot Volume: Macintosh HD
Boot Mode: Normal
With default mac sqlite3:
3.13.0 2016-05-18 10:57:30 fc49f556e48970561d7ab6a2f24fdd7d9eb81ff2

I have added the package using dep:

# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.


[[projects]]
  name = "github.com/mattn/go-sqlite3"
  packages = ["."]
  revision = "ca5e3819723d8eeaf170ad510e7da1d6d2e94a08"
  version = "v1.2.0"

[[projects]]
  branch = "master"
  name = "golang.org/x/net"
  packages = ["context"]
  revision = "1c05540f6879653db88113bc4a2b70aec4bd491f"

[solve-meta]
  analyzer-name = "dep"
  analyzer-version = 1
  inputs-digest = "983b42a768fbefe59019e8df9981b7fb3b134aed5748c41fa9a096e944f3cd57"
  solver-name = "gps-cdcl"
  solver-version = 1
package main

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

func main() {
	log.Print("Hello") //Never getting in there....
	driver := sqlite3.SQLiteDriver{}
	con, err := driver.Open("test.db")
	if err != nil {
		log.Fatal("Error connecting to the database")
	}
	defer con.Close()
	log.Println("Closing conenction")
}

As soon as I import the package the main function hang... No error... No time out... It simply hangs. no log is written

/usr/local/Cellar/go/1.8.3/libexec/bin/go run /Users/aroba/gocode/src/github.com/alexandreroba/todobackend/cmd/todo/main.go

I tried to create a database using the command line (sqlite3) with a table and inserting a record. It all worked well.

Any idea why this is happening ?

@mattn
Copy link
Owner

mattn commented Aug 21, 2017

Do you use latest xcode?

golang/go#19734

@AlexandreRoba
Copy link
Author

Hi mattn,
Thanks for getting back to me.

I believe I do have the latest version. My system is up to date...
I've started Xcode. I was NOT asked to agree on any terms... the version i currently have is Version 8.3.3 (8E3004b).
Let me know if you need more information.
Alex

@mattn
Copy link
Owner

mattn commented Aug 21, 2017

Do you try this package from database/sql?

@prologic
Copy link

I get this as well. Build times are many orders of magnitude slower just by:

import (
	"database/sql"
	"log"

	_ "github.com/mattn/go-sqlite3"
)

I don't understand why yet.

@mattn
Copy link
Owner

mattn commented Oct 19, 2017

you can make the time to build faster.

go install github.com/mattn/go-sqlite3

@prologic
Copy link

prologic commented Oct 19, 2017 via email

@mattn
Copy link
Owner

mattn commented Oct 19, 2017

This install compiled-package into $GOPATH/pkg. So the next build should be faster.

@prologic
Copy link

prologic commented Oct 19, 2017 via email

gjrtimmer added a commit to gjrtimmer/go-sqlite3 that referenced this issue May 26, 2018
Compile Section Closes mattn#175
Compile Section Closes mattn#201
Compile Section Closes mattn#206
Compile Section Closes mattn#404
Compile Section Closes mattn#217
Compile Section Closes mattn#224
Compile Section Closes mattn#234
Compile Section Closes mattn#242
Feature table Closes mattn#255
Description Section Closes mattn#232
Golang:1.6 not supported Closes mattn#272
Golang:1.5 not supported + compilation section Closes mattn#283
usleep Implemented Closes mattn#285
FAQ Section Closes mattn#289
Compile Section closes mattn#295
FAQ Section Closes mattn#305
PR339 Closes mattn#318 mattn#321
Compilation Section Closes mattn#341
PR407 Closes mattn#364
Feature `sqlite_vtable` Closes mattn#393
Compile Section Closes mattn#416
sqlite_trace feature Closes mattn#433
Compilation Section Closes mattn#435
Compilation Section Closes mattn#443
Golang:1.6 Not Supported Closes mattn#445
Compilation Section Closes mattn#451
Compilation Section Closes mattn#467
Compilation Section Closes mattn#491
Compilation Section Closes mattn#495
Compilation Section Closes mattn#505
Compilation Section Closes mattn#557
Compilation Section Closes mattn#560
@mattn mattn closed this as completed in c9394b1 May 27, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants