#5053·steampipe

LocalDbClient embeds DbClient by value, copying its atomic lock/flag fields (govet copylocks)

Author: kaidaguerreCreated Sep 24, 2026Updated Sep 24, 2026

LocalDbClient embeds db_client.DbClient by value, which go vet's copylocks check flags because DbClient contains atomic.Bool fields.

Where: pkg/db/db_local/local_db_client.go, LocalDbClient struct and newLocalClient.

What happens today: newLocalClient does &LocalDbClient{DbClient: *dbClient, ...}, copying the struct (including its sessionsLockFlag/disableTiming atomic.Bool fields) by value into the embedded field. This is unsound in general (copying a struct that contains synchronization primitives), though tracing the current call graph shows the original *db_client.DbClient pointer from NewDbClient is never retained or used again after construction, so there's no currently-triggerable divergence.

What a fix would change for users: switching the embed to *db_client.DbClient (pointer) is the correct fix and was applied then reverted from this PR because it couldn't be covered by a real regression test - there's no existing code path where the bug is currently observable, so a test would have to contrive a scenario that doesn't occur in production.

What analysis is needed before fixing: confirm no future change re-introduces a second holder of the original *DbClient pointer, and consider whether a regression test is worth adding a test-only accessor to db_client.DbClient to make the field observable from pkg/db/db_local's test package.

Generated with Claude Code

https://claude.ai/code/session_01VGDYEHuq4iigxBKFBhJije