Skip to content

Commit 1dd3f19

Browse files
lunnylafriks
andauthored
Use google/uuid to instead satori/go.uuid (#11943)
Co-authored-by: Lauris BH <[email protected]>
1 parent 03ba974 commit 1dd3f19

38 files changed

+967
-817
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ require (
5050
github.com/gogs/cron v0.0.0-20171120032916-9f6c956d3e14
5151
github.com/golang/protobuf v1.4.1 // indirect
5252
github.com/google/go-github/v24 v24.0.1
53+
github.com/google/uuid v1.1.1
5354
github.com/gorilla/context v1.1.1
5455
github.com/hashicorp/go-retryablehttp v0.6.6 // indirect
5556
github.com/huandu/xstrings v1.3.0
@@ -85,7 +86,6 @@ require (
8586
github.com/prometheus/procfs v0.0.4 // indirect
8687
github.com/quasoft/websspi v1.0.0
8788
github.com/remyoudompheng/bigfft v0.0.0-20190321074620-2f0d2b0e0001 // indirect
88-
github.com/satori/go.uuid v1.2.0
8989
github.com/sergi/go-diff v1.1.0
9090
github.com/shurcooL/httpfs v0.0.0-20190527155220-6a4d4a70508b // indirect
9191
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,6 @@ github.com/remyoudompheng/bigfft v0.0.0-20190321074620-2f0d2b0e0001/go.mod h1:qq
580580
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
581581
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
582582
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
583-
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
584-
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
585583
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
586584
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
587585
github.com/shurcooL/httpfs v0.0.0-20190527155220-6a4d4a70508b h1:4kg1wyftSKxLtnPAvcRWakIPpokB9w780/KwrNLnfPA=

models/attachment.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
api "code.gitea.io/gitea/modules/structs"
1515
"code.gitea.io/gitea/modules/timeutil"
1616

17-
gouuid "github.com/satori/go.uuid"
17+
gouuid "github.com/google/uuid"
1818
"xorm.io/xorm"
1919
)
2020

@@ -97,7 +97,7 @@ func (a *Attachment) LinkedRepository() (*Repository, UnitType, error) {
9797

9898
// NewAttachment creates a new attachment object.
9999
func NewAttachment(attach *Attachment, buf []byte, file io.Reader) (_ *Attachment, err error) {
100-
attach.UUID = gouuid.NewV4().String()
100+
attach.UUID = gouuid.New().String()
101101

102102
localPath := attach.LocalPath()
103103
if err = os.MkdirAll(path.Dir(localPath), os.ModePerm); err != nil {

models/oauth2_application.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"code.gitea.io/gitea/modules/timeutil"
1717

1818
"github.com/dgrijalva/jwt-go"
19-
uuid "github.com/satori/go.uuid"
19+
uuid "github.com/google/uuid"
2020
"github.com/unknwon/com"
2121
"golang.org/x/crypto/bcrypt"
2222
"xorm.io/xorm"
@@ -174,7 +174,7 @@ func CreateOAuth2Application(opts CreateOAuth2ApplicationOptions) (*OAuth2Applic
174174
}
175175

176176
func createOAuth2Application(e Engine, opts CreateOAuth2ApplicationOptions) (*OAuth2Application, error) {
177-
clientID := uuid.NewV4().String()
177+
clientID := uuid.New().String()
178178
app := &OAuth2Application{
179179
UID: opts.UserID,
180180
Name: opts.Name,

models/token.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"code.gitea.io/gitea/modules/generate"
1414
"code.gitea.io/gitea/modules/timeutil"
1515

16-
gouuid "github.com/satori/go.uuid"
16+
gouuid "github.com/google/uuid"
1717
)
1818

1919
// AccessToken represents a personal access token.
@@ -45,7 +45,7 @@ func NewAccessToken(t *AccessToken) error {
4545
return err
4646
}
4747
t.TokenSalt = salt
48-
t.Token = base.EncodeSha1(gouuid.NewV4().String())
48+
t.Token = base.EncodeSha1(gouuid.New().String())
4949
t.TokenHash = hashToken(t.Token, t.TokenSalt)
5050
t.TokenLastEight = t.Token[len(t.Token)-8:]
5151
_, err = x.Insert(t)

models/upload.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
"code.gitea.io/gitea/modules/setting"
1616

17-
gouuid "github.com/satori/go.uuid"
17+
gouuid "github.com/google/uuid"
1818
"github.com/unknwon/com"
1919
)
2020

@@ -46,7 +46,7 @@ func (upload *Upload) LocalPath() string {
4646
// NewUpload creates a new upload object.
4747
func NewUpload(name string, buf []byte, file multipart.File) (_ *Upload, err error) {
4848
upload := &Upload{
49-
UUID: gouuid.NewV4().String(),
49+
UUID: gouuid.New().String(),
5050
Name: name,
5151
}
5252

models/webhook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
api "code.gitea.io/gitea/modules/structs"
1616
"code.gitea.io/gitea/modules/timeutil"
1717

18-
gouuid "github.com/satori/go.uuid"
18+
gouuid "github.com/google/uuid"
1919
)
2020

2121
// HookContentType is the content type of a web hook
@@ -769,7 +769,7 @@ func createHookTask(e Engine, t *HookTask) error {
769769
if err != nil {
770770
return err
771771
}
772-
t.UUID = gouuid.NewV4().String()
772+
t.UUID = gouuid.New().String()
773773
t.PayloadContent = string(data)
774774
_, err = e.Insert(t)
775775
return err

modules/auth/oauth2/oauth2.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"code.gitea.io/gitea/modules/log"
1111
"code.gitea.io/gitea/modules/setting"
1212

13+
uuid "github.com/google/uuid"
1314
"github.com/lafriks/xormstore"
1415
"github.com/markbates/goth"
1516
"github.com/markbates/goth/gothic"
@@ -25,7 +26,6 @@ import (
2526
"github.com/markbates/goth/providers/openidConnect"
2627
"github.com/markbates/goth/providers/twitter"
2728
"github.com/markbates/goth/providers/yandex"
28-
uuid "github.com/satori/go.uuid"
2929
"xorm.io/xorm"
3030
)
3131

@@ -61,7 +61,7 @@ func Init(x *xorm.Engine) error {
6161
gothic.Store = store
6262

6363
gothic.SetState = func(req *http.Request) string {
64-
return uuid.NewV4().String()
64+
return uuid.New().String()
6565
}
6666

6767
gothic.GetProviderName = func(req *http.Request) (string, error) {

modules/auth/sso/reverseproxy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
"gitea.com/macaron/macaron"
1616
"gitea.com/macaron/session"
17-
gouuid "github.com/satori/go.uuid"
17+
gouuid "github.com/google/uuid"
1818
)
1919

2020
// Ensure the struct implements the interface.
@@ -92,7 +92,7 @@ func (r *ReverseProxy) newUser(ctx *macaron.Context) *models.User {
9292
return nil
9393
}
9494

95-
email := gouuid.NewV4().String() + "@localhost"
95+
email := gouuid.New().String() + "@localhost"
9696
if setting.Service.EnableReverseProxyEmail {
9797
webAuthEmail := ctx.Req.Header.Get(setting.ReverseProxyAuthEmail)
9898
if len(webAuthEmail) > 0 {

modules/auth/sso/sspi_windows.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
"gitea.com/macaron/macaron"
1818
"gitea.com/macaron/session"
1919

20+
gouuid "github.com/google/uuid"
2021
"github.com/quasoft/websspi"
21-
gouuid "github.com/satori/go.uuid"
2222
)
2323

2424
const (
@@ -157,12 +157,12 @@ func (s *SSPI) shouldAuthenticate(ctx *macaron.Context) (shouldAuth bool) {
157157
// newUser creates a new user object for the purpose of automatic registration
158158
// and populates its name and email with the information present in request headers.
159159
func (s *SSPI) newUser(ctx *macaron.Context, username string, cfg *models.SSPIConfig) (*models.User, error) {
160-
email := gouuid.NewV4().String() + "@localhost.localdomain"
160+
email := gouuid.New().String() + "@localhost.localdomain"
161161
user := &models.User{
162162
Name: username,
163163
Email: email,
164164
KeepEmailPrivate: true,
165-
Passwd: gouuid.NewV4().String(),
165+
Passwd: gouuid.New().String(),
166166
IsActive: cfg.AutoActivateUsers,
167167
Language: cfg.DefaultLanguage,
168168
UseCustomAvatar: true,

modules/migrations/gitea.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"code.gitea.io/gitea/modules/structs"
3030
"code.gitea.io/gitea/modules/timeutil"
3131

32-
gouuid "github.com/satori/go.uuid"
32+
gouuid "github.com/google/uuid"
3333
)
3434

3535
var (
@@ -260,7 +260,7 @@ func (g *GiteaLocalUploader) CreateReleases(releases ...*base.Release) error {
260260

261261
for _, asset := range release.Assets {
262262
var attach = models.Attachment{
263-
UUID: gouuid.NewV4().String(),
263+
UUID: gouuid.New().String(),
264264
Name: asset.Name,
265265
DownloadCount: int64(*asset.DownloadCount),
266266
Size: int64(*asset.Size),

vendor/github.com/google/uuid/.travis.yml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/google/uuid/CONTRIBUTING.md

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/google/uuid/CONTRIBUTORS

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/google/uuid/LICENSE

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/google/uuid/README.md

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/google/uuid/dce.go

Lines changed: 80 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/google/uuid/doc.go

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/google/uuid/go.mod

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)