Switch to google/uuid module

Current used github.com/pborman/uuid hasn't seen any updates in years.

Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info>
This commit is contained in:
Mikel Olasagasti Uranga
2025-01-11 21:31:26 +01:00
parent 4076941bd7
commit 7074fc8856
11 changed files with 22 additions and 27 deletions

View File

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

View File

@@ -1,11 +1,11 @@
package etcddb
import (
"github.com/aptly-dev/aptly/database"
"github.com/pborman/uuid"
clientv3 "go.etcd.io/etcd/client/v3"
"fmt"
"github.com/aptly-dev/aptly/database"
"github.com/google/uuid"
clientv3 "go.etcd.io/etcd/client/v3"
)
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,

View File

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

View File

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

View File

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

View File

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

View File

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

1
debian/control vendored
View File

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

View File

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

3
go.mod
View File

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

3
go.sum
View File

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