fix: Update whatsmeow API calls & switch to pure-Go SQLite driver - #295
Open
malganis35 wants to merge 1 commit into
Open
fix: Update whatsmeow API calls & switch to pure-Go SQLite driver#295malganis35 wants to merge 1 commit into
malganis35 wants to merge 1 commit into
Conversation
…ending capabilities
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: Update whatsmeow API calls & switch to pure-Go SQLite driver
Description
This pull request updates the
whatsmeowclient library method calls inwhatsapp-bridge/main.goto conform to modern, context-aware API signatures. In addition, it migrates the project's SQLite driver from the CGO-dependentmattn/go-sqlite3to the pure-Goglebarez/go-sqliteto allow seamless compilation on environments without a local C toolchain (e.g., Windows without GCC).Why these changes are necessary
1. Modern Handshake and Context Requirements
Recent updates to the
whatsmeowandsqlstorepackages deprecate older signature variants in favor of context-aware methods. Passingcontext.Background()to these functions ensures that operations are cancellable, leak-proof, and compliant with the latest library conventions.2. CGO-Free Build Support
The
github.com/mattn/go-sqlite3library requires CGO enabled, which demands a local GCC compiler. This makes running the bridge difficult on standard Windows systems without setting up MSYS2 or MinGW. Switching togithub.com/glebarez/go-sqlite(which wrapsmodernc.org/sqlite) removes the CGO compiler dependency while maintaining fully compatible SQLite dialect operations.Proposed Changes
API Signature Patches (
main.go)Passes
context.Background()as the first parameter to:client.Download(insidedownloadMedia)sqlstore.New(insidemain)container.GetFirstDevice(insidemain)client.GetGroupInfo(insideGetChatName)client.Store.Contacts.GetContact(insideGetChatName)Database Driver Migration
github.com/mattn/go-sqlite3withgithub.com/glebarez/go-sqlitein main.go.sql.Openandsqlstore.Newfrom"sqlite3"to"sqlite".?_foreign_keys=onto?_pragma=foreign_keys(1). The pure-Go SQLite driver parses and applies connection-level PRAGMAs using this format, ensuring that foreign keys constraint checks remain fully active.go.modandgo.sumto track the new dependencies.How to Test and Verify
$env:CGO_ENABLED=0go run .Risk / Impact Assessment
go 1.25and compiles seamlessly with zero CGO dependencies.