Use google/uuid to instead satori/go.uuid (#11943)
Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
03ba974481
commit
1dd3f19ee3
38 changed files with 967 additions and 817 deletions
|
@ -14,7 +14,7 @@ import (
|
|||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
gouuid "github.com/satori/go.uuid"
|
||||
gouuid "github.com/google/uuid"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
|
@ -97,7 +97,7 @@ func (a *Attachment) LinkedRepository() (*Repository, UnitType, error) {
|
|||
|
||||
// NewAttachment creates a new attachment object.
|
||||
func NewAttachment(attach *Attachment, buf []byte, file io.Reader) (_ *Attachment, err error) {
|
||||
attach.UUID = gouuid.NewV4().String()
|
||||
attach.UUID = gouuid.New().String()
|
||||
|
||||
localPath := attach.LocalPath()
|
||||
if err = os.MkdirAll(path.Dir(localPath), os.ModePerm); err != nil {
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
uuid "github.com/google/uuid"
|
||||
"github.com/unknwon/com"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"xorm.io/xorm"
|
||||
|
@ -174,7 +174,7 @@ func CreateOAuth2Application(opts CreateOAuth2ApplicationOptions) (*OAuth2Applic
|
|||
}
|
||||
|
||||
func createOAuth2Application(e Engine, opts CreateOAuth2ApplicationOptions) (*OAuth2Application, error) {
|
||||
clientID := uuid.NewV4().String()
|
||||
clientID := uuid.New().String()
|
||||
app := &OAuth2Application{
|
||||
UID: opts.UserID,
|
||||
Name: opts.Name,
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
"code.gitea.io/gitea/modules/generate"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
gouuid "github.com/satori/go.uuid"
|
||||
gouuid "github.com/google/uuid"
|
||||
)
|
||||
|
||||
// AccessToken represents a personal access token.
|
||||
|
@ -45,7 +45,7 @@ func NewAccessToken(t *AccessToken) error {
|
|||
return err
|
||||
}
|
||||
t.TokenSalt = salt
|
||||
t.Token = base.EncodeSha1(gouuid.NewV4().String())
|
||||
t.Token = base.EncodeSha1(gouuid.New().String())
|
||||
t.TokenHash = hashToken(t.Token, t.TokenSalt)
|
||||
t.TokenLastEight = t.Token[len(t.Token)-8:]
|
||||
_, err = x.Insert(t)
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
gouuid "github.com/satori/go.uuid"
|
||||
gouuid "github.com/google/uuid"
|
||||
"github.com/unknwon/com"
|
||||
)
|
||||
|
||||
|
@ -46,7 +46,7 @@ func (upload *Upload) LocalPath() string {
|
|||
// NewUpload creates a new upload object.
|
||||
func NewUpload(name string, buf []byte, file multipart.File) (_ *Upload, err error) {
|
||||
upload := &Upload{
|
||||
UUID: gouuid.NewV4().String(),
|
||||
UUID: gouuid.New().String(),
|
||||
Name: name,
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
gouuid "github.com/satori/go.uuid"
|
||||
gouuid "github.com/google/uuid"
|
||||
)
|
||||
|
||||
// HookContentType is the content type of a web hook
|
||||
|
@ -769,7 +769,7 @@ func createHookTask(e Engine, t *HookTask) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.UUID = gouuid.NewV4().String()
|
||||
t.UUID = gouuid.New().String()
|
||||
t.PayloadContent = string(data)
|
||||
_, err = e.Insert(t)
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue