chore: use stdlib uuid package

Go 1.27 ships a uuid package with the same API, dropping the direct
dependency on github.com/google/uuid.

Assisted-by: Claude:Opus 5
This commit is contained in:
silverwind
2026-08-19 23:21:38 +02:00
parent 052bc4b496
commit c15e6e793b
15 changed files with 20 additions and 20 deletions
+1 -1
View File
@@ -60,7 +60,6 @@ require (
github.com/google/go-github/v89 v89.0.0
github.com/google/licenseclassifier/v2 v2.0.0
github.com/google/pprof v0.0.0-20260802141513-ef3492d7dac3
github.com/google/uuid v1.6.0
github.com/gorilla/feeds v1.2.0
github.com/gorilla/sessions v1.4.0
github.com/hashicorp/go-version v1.9.0
@@ -194,6 +193,7 @@ require (
github.com/google/flatbuffers v25.12.19+incompatible // indirect
github.com/google/go-querystring v1.2.0 // indirect
github.com/google/go-tpm v0.9.8 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/css v1.0.1 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
+1 -1
View File
@@ -21,9 +21,9 @@ import (
"gitea.dev/modules/timeutil"
"gitea.dev/modules/util"
uuid "github.com/google/uuid"
"golang.org/x/crypto/bcrypt"
"golang.org/x/oauth2"
"uuid"
"xorm.io/builder"
"xorm.io/xorm"
)
+2 -2
View File
@@ -17,7 +17,7 @@ import (
"gitea.dev/modules/setting"
"gitea.dev/modules/util"
gouuid "github.com/google/uuid"
"uuid"
)
// ErrUploadNotExist represents a "UploadNotExist" kind of error.
@@ -60,7 +60,7 @@ func (upload *Upload) LocalPath() string {
// NewUpload creates a new upload object.
func NewUpload(ctx context.Context, name string, buf []byte, file multipart.File) (_ *Upload, err error) {
upload := &Upload{
UUID: gouuid.New().String(),
UUID: uuid.New().String(),
Name: name,
}
+2 -2
View File
@@ -15,7 +15,7 @@ import (
"gitea.dev/modules/timeutil"
webhook_module "gitea.dev/modules/webhook"
gouuid "github.com/google/uuid"
"uuid"
"xorm.io/builder"
)
@@ -119,7 +119,7 @@ func HookTasks(ctx context.Context, hookID int64, page int) ([]*HookTask, error)
// CreateHookTask creates a new hook task,
// it handles conversion from Payload to PayloadContent.
func CreateHookTask(ctx context.Context, t *HookTask) (*HookTask, error) {
t.UUID = gouuid.New().String()
t.UUID = uuid.New().String()
if t.Delivered == 0 {
t.Delivered = timeutil.TimeStampNanoNow()
}
+1 -1
View File
@@ -15,9 +15,9 @@ import (
"gitea.dev/modules/timeutil"
webhook_module "gitea.dev/modules/webhook"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"uuid"
"xorm.io/builder"
)
+2 -2
View File
@@ -20,10 +20,10 @@ import (
actions_service "gitea.dev/services/actions"
"connectrpc.com/connect"
gouuid "github.com/google/uuid"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
"uuid"
)
func NewRunnerServiceHandler() (string, http.Handler) {
@@ -74,7 +74,7 @@ func (s *Service) Register(
// create new runner
name := util.EllipsisDisplayString(req.Msg.Name, 255)
runner := &actions_model.ActionRunner{
UUID: gouuid.New().String(),
UUID: uuid.New().String(),
Name: name,
OwnerID: runnerToken.OwnerID,
RepoID: runnerToken.RepoID,
+1 -1
View File
@@ -36,7 +36,7 @@ import (
packages_service "gitea.dev/services/packages"
container_service "gitea.dev/services/packages/container"
"github.com/google/uuid"
"uuid"
)
const (
+1 -1
View File
@@ -18,7 +18,7 @@ import (
"gitea.dev/modules/util"
"gitea.dev/services/context/upload"
"github.com/google/uuid"
"uuid"
)
// NewAttachment creates a new attachment object, but do not verify.
+2 -2
View File
@@ -14,7 +14,7 @@ import (
"gitea.dev/modules/session"
"gitea.dev/modules/setting"
gouuid "github.com/google/uuid"
"uuid"
)
// Ensure the struct implements the interface.
@@ -143,7 +143,7 @@ func (r *ReverseProxy) newUser(req *http.Request) *user_model.User {
return nil
}
email := gouuid.New().String() + "@localhost"
email := uuid.New().String() + "@localhost"
if setting.Service.EnableReverseProxyEmail {
webAuthEmail := req.Header.Get(setting.ReverseProxyAuthEmail)
if len(webAuthEmail) > 0 {
+1 -1
View File
@@ -15,9 +15,9 @@ import (
"gitea.dev/modules/optional"
"gitea.dev/modules/setting"
"github.com/google/uuid"
"github.com/gorilla/sessions"
"github.com/markbates/goth/gothic"
"uuid"
)
var gothRWMutex = sync.RWMutex{}
@@ -14,7 +14,7 @@ import (
"gitea.dev/modules/optional"
"gitea.dev/modules/setting"
"github.com/google/uuid"
"uuid"
)
// Authenticate queries if login/password is valid against the PAM,
+2 -2
View File
@@ -20,7 +20,7 @@ import (
"gitea.dev/services/auth/source/sspi"
gitea_context "gitea.dev/services/context"
gouuid "github.com/google/uuid"
"uuid"
)
const (
@@ -156,7 +156,7 @@ func (s *SSPI) shouldAuthenticate(req *http.Request) (shouldAuth bool) {
// newUser creates a new user object for the purpose of automatic registration
// and populates its name and email with the information present in request headers.
func (s *SSPI) newUser(ctx context.Context, username string, cfg *sspi.Source) (*user_model.User, error) {
email := gouuid.New().String() + "@localhost.localdomain"
email := uuid.New().String() + "@localhost.localdomain"
user := &user_model.User{
Name: username,
Email: email,
+1 -1
View File
@@ -25,8 +25,8 @@ import (
"gitea.dev/modules/setting"
"gitea.dev/modules/structs"
"github.com/google/uuid"
"go.yaml.in/yaml/v4"
"uuid"
)
var _ base.Uploader = &RepositoryDumper{}
+1 -1
View File
@@ -33,7 +33,7 @@ import (
"gitea.dev/services/pull"
repo_service "gitea.dev/services/repository"
"github.com/google/uuid"
"uuid"
)
var _ base.Uploader = &GiteaLocalUploader{}
@@ -14,9 +14,9 @@ import (
user_model "gitea.dev/models/user"
"gitea.dev/tests"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"uuid"
)
func TestPackageTerraform(t *testing.T) {