lib / pq

Pure Go Postgres driver for database/sql
https://pkg.go.dev/github.com/lib/pq
MIT License
8.89k stars 906 forks source link

`GOOS=android` build error #1051

Closed neilalexander closed 2 years ago

neilalexander commented 2 years ago

A user_posix.go:12:6: userCurrent redeclared in this block error appeared with v1.10.2 when cross-building a project using GOOS=android. Downgrading to v1.10.1 works.

# github.com/lib/pq
/var/folders/bm/jdxjy5b55vn2dy5ngpl5j1wm0000gn/T/gomobile-work-192690997/pkg/mod/github.com/lib/pq@v1.10.2/user_posix.go:12:6: userCurrent redeclared in this block
        previous declaration at /var/folders/bm/jdxjy5b55vn2dy5ngpl5j1wm0000gn/T/gomobile-work-192690997/pkg/mod/github.com/lib/pq@v1.10.2/user_other.go:7:29
gomobile: go build -v -ldflags -s -w -trimpath -buildmode=c-shared -o=/var/folders/bm/jdxjy5b55vn2dy5ngpl5j1wm0000gn/T/gomobile-work-192690997/android/src/main/jniLibs/armeabi-v7a/libgojni.so ./gobind failed: exit status 2
jiggleexe commented 2 years ago

Same here have you found the solution?

cbandy commented 2 years ago

user_other.go should contain the negation of the supported userCurrent() implementations. Like,

// +build !aix
// +build !darwin
…
// +build !windows

See #1036.