sqlc-dev / sqlc

Generate type-safe code from SQL
https://sqlc.dev
MIT License
13.58k stars 812 forks source link

[OSX] sqlc installed via go install crashes due to invalid code signing #3651

Closed ajorgensen closed 1 month ago

ajorgensen commented 1 month ago

Version

1.27.0

What happened?

Installing sqlc via go install seems to result in an invalid signed binary which crashes on osx.

Steps to reproduce

$ go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
$ sqlc version
[1]    12098 killed     sqlc version
codesign --verify --deep $(which sqlc)
/Users/ajorgensen/go/bin/sqlc: invalid signature (code or signature have been modified)
In architecture: arm64

dmesg output

[ 4793.292055]: CODE SIGNING: process 8391[sqlc]: rejecting invalid page at address 0x104b74000 from offset 0x0 in file "/Users/ajorgensen/go/bin/sqlc" (cs_mtime:1728738188.769243662 == mtime:1728738188.769243662) (signed:1 validated:1 tainted:1 nx:0 wpmapped:0 dirty:0 depth:0)
[ 4793.292102]: sqlc[8391] Corpse allowed 1 of 5
[ 4793.294490]: [SPI][HIDSPI] 

However it appears that if the binary is installed via Homebrew it is signed correctly

$ brew install sqlc
$ sqlc version
v1.27.0
$ codesign --verify --deep $(which sqlc)
$ echo $?
0

Relevant log output

No response

Database schema

none

SQL queries

none

Configuration

none

Playground URL

No response

What operating system are you using?

macOS

What database engines are you using?

SQLite

What type of code are you generating?

Go

ajorgensen commented 1 month ago

Sorry, this ended up being user error. Reinstalling go seems to have fixed the issue