mattn / go-sqlite3

sqlite3 driver for go using database/sql
http://mattn.github.io/go-sqlite3
MIT License
8.05k stars 1.11k forks source link

Can amalgamation files be moved back to separate directory? #1020

Open rittneje opened 2 years ago

rittneje commented 2 years ago

In #294, the sqlite3-binding.c, etc. files were moved out of a sub-directory for better compatibility with tools like godep. This in turn caused issues with the libsqlite3 build tag due to the way cgo works, which necessitated that the amalgamation files be manually patched to include an #ifndef USE_LIBSQLITE3 check. This manual patch then must be re-inserted each time we upgrade SQLite.

As godep, etc. are likely no longer maintained in the wake of go mod, we should revisit this point. If the files are moved back to a sub-directory, will it still work properly with go mod? Can we stop having to manually patch the amalgamation files?

mattn commented 2 years ago

I'm experimentally trying if the C code can be moved to amagramation but seems not to be easy.

https://github.com/mattn/go-sqlite3/tree/move-code

c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: $WORK\b001\_x005.o:sqlite3.cgo2.c:(.rdata$.refptr.sqlite3_version[.refptr.sqlite3_version]+0x0): undefined reference to `sqlite3_version'                                                                                                                                                                                       collect2.exe: error: ld returned 1 exit status