refactor: use Go 1.27 standard library uuid instead of satori/go.uuid - #276
Merged
Merged
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.
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
内部的に使っているUUID実装を、サードパーティの
github.com/satori/go.uuidから Go 1.27 で標準ライブラリに追加されたuuidパッケージに移行します。Changes
UUID 移行(API 対応表)
uuid.FromString(...)→uuid.Parse(...)uuid.FromStringOrNil(...)→uuid.MustParse(...)(テストの固定 UUID 文字列のみ)uuid.Equal(a, b)→a == b(stduuid.UUIDは比較可能な[16]byte)uuid.NewV4()/uuid.UUID/uuid.UUID{}/.String()は API 互換go.modのgoディレクティブを1.25→1.27に引き上げ、satori/go.uuid依存を削除DB 層(mysql)
std
uuid.UUIDは satori と違いdriver.Valuer/sql.Scannerを持たないため、UUID 列(VARCHAR(36))との入出力を文字列で処理:uuid.UUID.String()をバインド(CreateTarget,EnqueueJob)uuid.Parseで標準型に復元uuid.UUIDのまま(memory/web/runner/starter への波及なし)CI
staticcheck@latest(v0.7.0)は Go 1.27 の export data(version 4)を解析できず内部エラーになるため、v0.8.0-rc.1 に固定(Go 1.27 対応)golang:1.25→golang:1.27に更新Verification
go build ./.../go vet ./...OKdocker-build-test/docker-build-shaパス