all: migrate from satori/go.uuid to google/uuid (#8161)

This commit is contained in:
ᴊᴏᴇ ᴄʜᴇɴ
2026-02-08 00:13:43 -05:00
committed by GitHub
parent 785157ba1f
commit 48500aa2b0
7 changed files with 11 additions and 14 deletions

3
go.mod
View File

@@ -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

2
go.sum
View File

@@ -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=

View File

@@ -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,
},

View File

@@ -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{

View File

@@ -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,
}

View File

@@ -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,
}

View File

@@ -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