From 7074fc8856ce08f23e365c27f02e185c771160db Mon Sep 17 00:00:00 2001 From: Mikel Olasagasti Uranga Date: Sat, 11 Jan 2025 21:31:26 +0100 Subject: [PATCH] Switch to google/uuid module Current used github.com/pborman/uuid hasn't seen any updates in years. Signed-off-by: Mikel Olasagasti Uranga --- azure/public.go | 4 ++-- database/etcddb/storage.go | 8 ++++---- deb/contents.go | 4 ++-- deb/local.go | 4 ++-- deb/publish.go | 4 ++-- deb/remote.go | 4 ++-- deb/snapshot.go | 8 ++++---- debian/control | 1 - files/package_pool.go | 4 ++-- go.mod | 3 +-- go.sum | 3 --- 11 files changed, 21 insertions(+), 26 deletions(-) diff --git a/azure/public.go b/azure/public.go index 6bda2599be..8792ee2439 100644 --- a/azure/public.go +++ b/azure/public.go @@ -12,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/lease" "github.com/aptly-dev/aptly/aptly" "github.com/aptly-dev/aptly/utils" - "github.com/pborman/uuid" + "github.com/google/uuid" "github.com/pkg/errors" ) @@ -179,7 +179,7 @@ func (storage *PublishedStorage) Filelist(prefix string) ([]string, error) { // Internal copy or move implementation func (storage *PublishedStorage) internalCopyOrMoveBlob(src, dst string, metadata map[string]*string, move bool) error { const leaseDuration = 30 - leaseID := uuid.NewRandom().String() + leaseID := uuid.NewString() serviceClient := storage.az.client.ServiceClient() containerClient := serviceClient.NewContainerClient(storage.az.container) diff --git a/database/etcddb/storage.go b/database/etcddb/storage.go index efc4cf64d0..65e3913bb2 100644 --- a/database/etcddb/storage.go +++ b/database/etcddb/storage.go @@ -1,11 +1,11 @@ package etcddb import ( + "fmt" + "github.com/aptly-dev/aptly/database" - "github.com/pborman/uuid" + "github.com/google/uuid" clientv3 "go.etcd.io/etcd/client/v3" - - "fmt" ) type EtcDStorage struct { @@ -16,7 +16,7 @@ type EtcDStorage struct { // CreateTemporary creates new DB of the same type in temp dir func (s *EtcDStorage) CreateTemporary() (database.Storage, error) { - tmp := uuid.NewRandom().String() + tmp := uuid.NewString() return &EtcDStorage{ url: s.url, db: s.db, diff --git a/deb/contents.go b/deb/contents.go index cc8f8cef72..8ca92e83c3 100644 --- a/deb/contents.go +++ b/deb/contents.go @@ -7,7 +7,7 @@ import ( "io" "github.com/aptly-dev/aptly/database" - "github.com/pborman/uuid" + "github.com/google/uuid" ) // ContentsIndex calculates mapping from files to packages, with sorting and aggregation @@ -20,7 +20,7 @@ type ContentsIndex struct { func NewContentsIndex(db database.Storage) *ContentsIndex { return &ContentsIndex{ db: db, - prefix: []byte(uuid.New()), + prefix: []byte(uuid.NewString()), } } diff --git a/deb/local.go b/deb/local.go index 1b09fdbda3..42d5d3f262 100644 --- a/deb/local.go +++ b/deb/local.go @@ -7,7 +7,7 @@ import ( "log" "github.com/aptly-dev/aptly/database" - "github.com/pborman/uuid" + "github.com/google/uuid" "github.com/ugorji/go/codec" ) @@ -32,7 +32,7 @@ type LocalRepo struct { // NewLocalRepo creates new instance of Debian local repository func NewLocalRepo(name string, comment string) *LocalRepo { return &LocalRepo{ - UUID: uuid.New(), + UUID: uuid.NewString(), Name: name, Comment: comment, } diff --git a/deb/publish.go b/deb/publish.go index 3bf397affb..1ef23fb94f 100644 --- a/deb/publish.go +++ b/deb/publish.go @@ -12,7 +12,7 @@ import ( "strings" "time" - "github.com/pborman/uuid" + "github.com/google/uuid" "github.com/ugorji/go/codec" "github.com/aptly-dev/aptly/aptly" @@ -354,7 +354,7 @@ func walkUpTree(source interface{}, collectionFactory *CollectionFactory) (rootD func NewPublishedRepo(storage, prefix, distribution string, architectures []string, components []string, sources []interface{}, collectionFactory *CollectionFactory, multiDist bool) (*PublishedRepo, error) { result := &PublishedRepo{ - UUID: uuid.New(), + UUID: uuid.NewString(), Storage: storage, Architectures: architectures, Sources: make(map[string]string), diff --git a/deb/remote.go b/deb/remote.go index 9f89f905bf..b10af86550 100644 --- a/deb/remote.go +++ b/deb/remote.go @@ -20,7 +20,7 @@ import ( "github.com/aptly-dev/aptly/http" "github.com/aptly-dev/aptly/pgp" "github.com/aptly-dev/aptly/utils" - "github.com/pborman/uuid" + "github.com/google/uuid" "github.com/ugorji/go/codec" ) @@ -84,7 +84,7 @@ type RemoteRepo struct { func NewRemoteRepo(name string, archiveRoot string, distribution string, components []string, architectures []string, downloadSources bool, downloadUdebs bool, downloadInstaller bool) (*RemoteRepo, error) { result := &RemoteRepo{ - UUID: uuid.New(), + UUID: uuid.NewString(), Name: name, ArchiveRoot: archiveRoot, Distribution: distribution, diff --git a/deb/snapshot.go b/deb/snapshot.go index f2a0d3879e..cd9b44df1d 100644 --- a/deb/snapshot.go +++ b/deb/snapshot.go @@ -11,7 +11,7 @@ import ( "github.com/aptly-dev/aptly/database" "github.com/aptly-dev/aptly/utils" - "github.com/pborman/uuid" + "github.com/google/uuid" "github.com/ugorji/go/codec" ) @@ -50,7 +50,7 @@ func NewSnapshotFromRepository(name string, repo *RemoteRepo) (*Snapshot, error) } return &Snapshot{ - UUID: uuid.New(), + UUID: uuid.NewString(), Name: name, CreatedAt: time.Now(), SourceKind: SourceRemoteRepo, @@ -66,7 +66,7 @@ func NewSnapshotFromRepository(name string, repo *RemoteRepo) (*Snapshot, error) // NewSnapshotFromLocalRepo creates snapshot from current state of local repository func NewSnapshotFromLocalRepo(name string, repo *LocalRepo) (*Snapshot, error) { snap := &Snapshot{ - UUID: uuid.New(), + UUID: uuid.NewString(), Name: name, CreatedAt: time.Now(), SourceKind: SourceLocalRepo, @@ -95,7 +95,7 @@ func NewSnapshotFromRefList(name string, sources []*Snapshot, list *PackageRefLi } return &Snapshot{ - UUID: uuid.New(), + UUID: uuid.NewString(), Name: name, CreatedAt: time.Now(), SourceKind: "snapshot", diff --git a/debian/control b/debian/control index b6c4d8ded7..1255d8be41 100644 --- a/debian/control +++ b/debian/control @@ -45,7 +45,6 @@ Build-Depends: bash-completion, golang-github-munnerz-goautoneg-dev, golang-github-mxk-go-flowrate-dev, golang-github-ncw-swift-dev, - golang-github-pborman-uuid-dev, golang-github-pelletier-go-toml, golang-github-pkg-errors-dev, golang-github-prometheus-client-golang-dev, diff --git a/files/package_pool.go b/files/package_pool.go index e82a74477a..4c815e6e21 100644 --- a/files/package_pool.go +++ b/files/package_pool.go @@ -9,7 +9,7 @@ import ( "sync" "syscall" - "github.com/pborman/uuid" + "github.com/google/uuid" "github.com/saracen/walker" "github.com/aptly-dev/aptly/aptly" @@ -417,7 +417,7 @@ func (pool *PackagePool) FullPath(path string) string { // GenerateTempPath generates temporary path for download (which is fast to import into package pool later on) func (pool *PackagePool) GenerateTempPath(filename string) (string, error) { - random := uuid.NewRandom().String() + random := uuid.NewString() return filepath.Join(pool.rootPath, random[0:2], random[2:4], random[4:]+filename), nil } diff --git a/go.mod b/go.mod index f74051b144..66a0cdda28 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,6 @@ require ( github.com/mkrautz/goar v0.0.0-20150919110319-282caa8bd9da github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f github.com/ncw/swift v1.0.53 - github.com/pborman/uuid v1.2.0 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.20.0 github.com/rs/zerolog v1.29.1 @@ -78,7 +77,6 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/josharian/intern v1.0.0 // indirect @@ -124,6 +122,7 @@ require ( github.com/aws/aws-sdk-go-v2/credentials v1.17.46 github.com/aws/aws-sdk-go-v2/service/s3 v1.67.1 github.com/aws/smithy-go v1.22.1 + github.com/google/uuid v1.6.0 github.com/swaggo/files v1.0.1 github.com/swaggo/gin-swagger v1.6.0 github.com/swaggo/swag v1.16.3 diff --git a/go.sum b/go.sum index 44ae9396f2..9aa11338cc 100644 --- a/go.sum +++ b/go.sum @@ -148,7 +148,6 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/h2non/filetype v1.1.3 h1:FKkx9QbD7HR/zjK1Ia5XiBsq9zdLi5Kf3zGyFTAFkGg= @@ -231,8 +230,6 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=