From 48500aa2b0c713b70d93ae456d3136538d2c512b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=B4=8A=E1=B4=8F=E1=B4=87=20=E1=B4=84=CA=9C=E1=B4=87?= =?UTF-8?q?=C9=B4?= Date: Sun, 8 Feb 2026 00:13:43 -0500 Subject: [PATCH] all: migrate from satori/go.uuid to google/uuid (#8161) --- go.mod | 3 +-- go.sum | 2 -- internal/context/auth.go | 4 ++-- internal/database/access_tokens.go | 4 ++-- internal/database/attachment.go | 4 ++-- internal/database/repo_editor.go | 4 ++-- internal/database/webhook.go | 4 ++-- 7 files changed, 11 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index b1256f0bf..cece62d87 100644 --- a/go.mod +++ b/go.mod @@ -26,6 +26,7 @@ require ( github.com/gogs/go-libravatar v0.0.0-20191106065024-33a75213d0a0 github.com/gogs/minwinsvc v0.0.0-20170301035411-95be6356811a github.com/google/go-github v17.0.0+incompatible + github.com/google/uuid v1.6.0 github.com/inbucket/html2text v1.0.0 github.com/issue9/identicon v1.2.1 github.com/json-iterator/go v1.1.12 @@ -36,7 +37,6 @@ require ( github.com/pquerna/otp v1.5.0 github.com/prometheus/client_golang v1.23.0 github.com/russross/blackfriday v1.6.0 - github.com/satori/go.uuid v1.2.0 github.com/sergi/go-diff v1.4.0 github.com/sourcegraph/run v0.12.0 github.com/stretchr/testify v1.11.1 @@ -94,7 +94,6 @@ require ( github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect github.com/google/go-querystring v1.0.0 // indirect - github.com/google/uuid v1.6.0 // indirect github.com/gorilla/css v1.0.1 // indirect github.com/itchyny/gojq v0.12.11 // indirect github.com/itchyny/timefmt-go v0.1.5 // indirect diff --git a/go.sum b/go.sum index c5f2369e1..357b9bb3d 100644 --- a/go.sum +++ b/go.sum @@ -405,8 +405,6 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca h1:NugYot0LIVPxTvN8n+Kvkn6TrbMyxQiuvKdEwFdR9vI= github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca/go.mod h1:uugorj2VCxiV1x+LzaIdVa9b4S4qGAcH6cbhh4qVxOU= -github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw= github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= diff --git a/internal/context/auth.go b/internal/context/auth.go index a5c459d52..487c8cfbb 100644 --- a/internal/context/auth.go +++ b/internal/context/auth.go @@ -9,7 +9,7 @@ import ( "github.com/cockroachdb/errors" "github.com/go-macaron/csrf" "github.com/go-macaron/session" - gouuid "github.com/satori/go.uuid" + "github.com/google/uuid" "gopkg.in/macaron.v1" log "unknwon.dev/clog/v2" @@ -219,7 +219,7 @@ func authenticatedUser(store AuthStore, ctx *macaron.Context, sess session.Store user, err = store.CreateUser( ctx.Req.Context(), webAuthUser, - gouuid.NewV4().String()+"@localhost", + uuid.New().String()+"@localhost", database.CreateUserOptions{ Activated: true, }, diff --git a/internal/database/access_tokens.go b/internal/database/access_tokens.go index e73954955..9837fe87f 100644 --- a/internal/database/access_tokens.go +++ b/internal/database/access_tokens.go @@ -6,7 +6,7 @@ import ( "time" "github.com/cockroachdb/errors" - gouuid "github.com/satori/go.uuid" + "github.com/google/uuid" "gorm.io/gorm" "gogs.io/gogs/internal/cryptoutil" @@ -80,7 +80,7 @@ func (s *AccessTokensStore) Create(ctx context.Context, userID int64, name strin return nil, err } - token := cryptoutil.SHA1(gouuid.NewV4().String()) + token := cryptoutil.SHA1(uuid.New().String()) sha256 := cryptoutil.SHA256(token) accessToken := &AccessToken{ diff --git a/internal/database/attachment.go b/internal/database/attachment.go index 9f7fe07ec..aba01d684 100644 --- a/internal/database/attachment.go +++ b/internal/database/attachment.go @@ -9,7 +9,7 @@ import ( "time" "github.com/cockroachdb/errors" - gouuid "github.com/satori/go.uuid" + "github.com/google/uuid" "xorm.io/xorm" "gogs.io/gogs/internal/conf" @@ -53,7 +53,7 @@ func (a *Attachment) LocalPath() string { // NewAttachment creates a new attachment object. func NewAttachment(name string, buf []byte, file multipart.File) (_ *Attachment, err error) { attach := &Attachment{ - UUID: gouuid.NewV4().String(), + UUID: uuid.New().String(), Name: name, } diff --git a/internal/database/repo_editor.go b/internal/database/repo_editor.go index ada47fcf0..7346f8e7f 100644 --- a/internal/database/repo_editor.go +++ b/internal/database/repo_editor.go @@ -13,7 +13,7 @@ import ( "time" "github.com/cockroachdb/errors" - gouuid "github.com/satori/go.uuid" + "github.com/google/uuid" "github.com/gogs/git-module" @@ -422,7 +422,7 @@ func NewUpload(name string, buf []byte, file multipart.File) (_ *Upload, err err } upload := &Upload{ - UUID: gouuid.NewV4().String(), + UUID: uuid.New().String(), Name: name, } diff --git a/internal/database/webhook.go b/internal/database/webhook.go index 250e99b0a..5906e2681 100644 --- a/internal/database/webhook.go +++ b/internal/database/webhook.go @@ -12,8 +12,8 @@ import ( "time" "github.com/cockroachdb/errors" + "github.com/google/uuid" jsoniter "github.com/json-iterator/go" - gouuid "github.com/satori/go.uuid" log "unknwon.dev/clog/v2" "xorm.io/xorm" @@ -512,7 +512,7 @@ func createHookTask(e Engine, t *HookTask) error { if err != nil { return err } - t.UUID = gouuid.NewV4().String() + t.UUID = uuid.New().String() t.PayloadContent = string(data) _, err = e.Insert(t) return err