Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to google/uuid module #1423

Merged
merged 1 commit into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions azure/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions database/etcddb/storage.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions deb/contents.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()),
}
}

Expand Down
4 changes: 2 additions & 2 deletions deb/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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,
}
Expand Down
4 changes: 2 additions & 2 deletions deb/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions deb/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions deb/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions files/package_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
Loading