Skip to content

Commit

Permalink
clairctl: Scan the pointer to the pointer of the bool
Browse files Browse the repository at this point in the history
I believe that even though ok is a *bool type, we still need to pass
it's address to Scan() otherwise it's akin to ok := bool; Scan(&ok),
which I believe only supports binary values and not nullable bools.

Signed-off-by: crozzy <[email protected]>
  • Loading branch information
crozzy committed Jul 5, 2023
1 parent a02a0f2 commit d2b3d82
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/clairctl/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func adminPre470(c *cli.Context) error {
const mkindex = `CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_manifest_index_manifest_id ON manifest_index(manifest_id);`
const reindex = `REINDEX INDEX CONCURRENTLY idx_manifest_index_manifest_id;`
var ok *bool
if err := conn.QueryRow(ctx, checkindex).Scan(ok); err != nil {
if err := conn.QueryRow(ctx, checkindex).Scan(&ok); err != nil {
if !errors.Is(err, pgx.ErrNoRows) {
zlog.Info(ctx).
AnErr("index_check", err).
Expand Down

0 comments on commit d2b3d82

Please sign in to comment.