Conversation
Replace github.com/satori/go.uuid with the standard library uuid package
added in Go 1.27.
- uuid.FromString -> uuid.Parse
- uuid.FromStringOrNil -> uuid.MustParse
- uuid.Equal(a, b) -> a == b (UUID is a comparable [16]byte)
- uuid.NewV4 / uuid.UUID / uuid.UUID{} map 1:1
Bump go directive 1.25 -> 1.27 and drop the satori/go.uuid module.
go.mod now requires Go >= 1.27 (standard library uuid), and the Dockerfile uses GOTOOLCHAIN=local, so the builder image must be 1.27.
staticcheck@latest resolves to v0.7.0 (2026.1), whose bundled x/tools cannot decode Go 1.27's export data (version 4) and fails with an internal error. v0.8.0-rc.1 (2026.2rc1) supports Go 1.27 and passes cleanly on the module.
The standard library uuid.UUID is a [16]byte with no driver.Valuer or sql.Scanner, unlike satori/go.uuid. UUID columns are VARCHAR(36), so: - Writes: pass uuid.UUID.String() when binding (CreateTarget, EnqueueJob). - Reads: scan rows into shadow structs whose UUID columns are strings, then parse back into datastore entities with uuid.Parse. Keeps the domain type as std uuid.UUID (no ripple into memory/web/runner/ starter) and confines DB conversion to the mysql package.
The sql.*FromSQL test helpers bound uuid.UUID directly to prepared statements, which fails with std uuid (no driver.Valuer/Scanner). Bind uuid.String() and scan into local shadow rows (UUID columns as strings) then parse back into datastore entities.
whywaita
commented
Aug 20, 2026
| UpdatedAt time.Time `db:"updated_at"` | ||
| } | ||
|
|
||
| func (r rowJob) job() (datastore.Job, error) { |
Owner
Author
There was a problem hiding this comment.
Be Go.
Suggested change
| func (r rowJob) job() (datastore.Job, error) { | |
| func (r rowJob) job() (*datastore.Job, error) { |
Owner
Author
There was a problem hiding this comment.
Addressed — this approach was replaced entirely. Instead of the shadow rowJob struct, I introduced datastore.UUID, which wraps std uuid.UUID and implements driver.Valuer + sql.Scanner. The datastore entity structs now use it, so sqlx binds/scans UUID columns directly and the mysql layer goes back to plain queries (no rowJob/rowRunner/rowTarget + string conversion). This makes the code cleaner and removes the need for this helper function altogether.
Implement a datastore.UUID type wrapping std uuid.UUID that implements driver.Valuer and sql.Scanner, and use it for the datastore entity structs and interface. This lets sqlx bind and scan UUID columns directly, so the mysql layer no longer needs shadow structs + string conversion. - New pkg/datastore/uuid.go: datastore.UUID (Valuer + Scanner) - datastore entity structs and Datastore interface use datastore.UUID - mysql: revert to direct queries (CreateTarget/EnqueueJob bind fields as-is) - memory/web/runner/starter/metric: adapted to datastore.UUID - tests updated accordingly Responds to the review comment on PR #278.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate the internal UUID implementation from the third-party
github.com/satori/go.uuidpackage to the standard libraryuuidpackage introduced in Go 1.27.Changes
UUID migration (API mapping)
uuid.FromString(...)→uuid.Parse(...)uuid.FromStringOrNil(...)→uuid.MustParse(...)(test-only, fixed UUID strings)uuid.Equal(a, b)→a == b(stduuid.UUIDis a comparable[16]byte)uuid.NewV4()/uuid.UUID/uuid.UUID{}/.String()are API-compatiblego.mod:go 1.25→go 1.27, drop thesatori/go.uuiddependencyDB layer (mysql)
std
uuid.UUIDdoes not implementdriver.Valuer/sql.Scanner(unlike satori). UUID columns areVARCHAR(36), so DB I/O is handled as strings:uuid.UUID.String()(CreateTarget,EnqueueJob)uuid.Parseuuid.UUID(no ripple into memory/web/runner/starter); DB conversion is confined to the mysql packageCI
staticcheck@latest(v0.7.0) cannot decode Go 1.27 export data (version 4), so pinstaticcheckto v0.8.0-rc.1golang:1.25→golang:1.27Verification
go build ./.../go vet ./...OKdocker-build-test/docker-build-shapass