You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, since Go 1.22.0, there exists a public API that could be used to fix this broken isolation boundary. The behavior of convertAssign is available in sql.Null.Scan() pretty much one-to-one: https://pkg.go.dev/database/sql#Null - The only difference is that it treats nil values differently, but it might be feasible to catch and handle this case explicitly before calling into sql.Null.Scan().
For reference, this is how I replaced another usage of go:linkname convertAssign in a different project: moznion/go-optional#44 - I have not created a PR for this repo since I'm not 100% sure of the semantics involved, but maybe it's similarly straightforward.
Note that using this API requires bumping go.mod to go 1.22, but since any older versions are EOL anyway, that ought to be acceptable.
The text was updated successfully, but these errors were encountered:
This package currently uses go:linkname to access
database/sql.convertAssign
and has earned itself an entry into the "hall of shame" from upstream for that: https://cs.opensource.google/go/go/+/refs/tags/go1.23.4:src/database/sql/convert.go;l=215However, since Go 1.22.0, there exists a public API that could be used to fix this broken isolation boundary. The behavior of
convertAssign
is available insql.Null.Scan()
pretty much one-to-one: https://pkg.go.dev/database/sql#Null - The only difference is that it treatsnil
values differently, but it might be feasible to catch and handle this case explicitly before calling intosql.Null.Scan()
.For reference, this is how I replaced another usage of
go:linkname convertAssign
in a different project: moznion/go-optional#44 - I have not created a PR for this repo since I'm not 100% sure of the semantics involved, but maybe it's similarly straightforward.Note that using this API requires bumping go.mod to
go 1.22
, but since any older versions are EOL anyway, that ought to be acceptable.The text was updated successfully, but these errors were encountered: