From aeab4b4453a2fb38a40b744a4a32f113e318f630 Mon Sep 17 00:00:00 2001 From: bufdev Date: Mon, 30 Sep 2024 13:00:01 -0400 Subject: [PATCH] Move uuid packages --- go.mod | 3 +-- go.sum | 2 -- private/buf/bufconvert/bufconvert_test.go | 2 +- private/buf/bufgen/features_test.go | 2 +- private/buf/buflsp/file.go | 2 +- private/buf/bufmigrate/migrate_builder.go | 2 +- private/buf/bufmigrate/migrator.go | 2 +- private/buf/bufworkspace/workspace_provider.go | 2 +- private/buf/cmd/buf/command/dep/depgraph/depgraph.go | 3 ++- private/buf/cmd/buf/command/lsfiles/lsfiles.go | 3 ++- private/buf/cmd/protoc-gen-buf-lint/lint_test.go | 2 +- .../internal/bufcheckserverutil/input_file.go | 2 +- private/bufpkg/bufconfig/buf_lock_file.go | 4 ++-- private/bufpkg/bufimage/bufimage.go | 4 ++-- .../bufpkg/bufimage/bufimagemodify/bufimagemodify_test.go | 2 +- private/bufpkg/bufimage/bufimagetesting/bufimagetesting.go | 2 +- .../bufpkg/bufimage/bufimagetesting/bufimagetesting_test.go | 2 +- private/bufpkg/bufimage/bufimageutil/bufimageutil_test.go | 2 +- private/bufpkg/bufimage/image.go | 2 +- private/bufpkg/bufimage/image_file.go | 2 +- private/bufpkg/bufimage/module_image_file_info.go | 2 +- private/bufpkg/bufimage/parser_accessor_handler.go | 4 ++-- private/bufpkg/bufimage/util.go | 3 ++- private/bufpkg/bufimage/well_known_type_image_file_info.go | 2 +- private/bufpkg/bufmodule/added_module.go | 2 +- private/bufpkg/bufmodule/bufmoduleapi/commit_provider.go | 2 +- private/bufpkg/bufmodule/bufmoduleapi/convert.go | 2 +- .../bufpkg/bufmodule/bufmoduleapi/digest_for_commit_id.go | 2 +- .../bufpkg/bufmodule/bufmoduleapi/module_data_provider.go | 2 +- .../bufpkg/bufmodule/bufmoduleapi/universal_proto_commit.go | 2 +- .../bufmodule/bufmoduleapi/universal_proto_content.go | 2 +- private/bufpkg/bufmodule/bufmoduleapi/uploader.go | 3 ++- private/bufpkg/bufmodule/bufmodulecache/base_provider.go | 2 +- private/bufpkg/bufmodule/bufmodulecache/commit_provider.go | 2 +- .../bufpkg/bufmodule/bufmodulecache/module_data_provider.go | 2 +- .../bufpkg/bufmodule/bufmoduletesting/bufmoduletesting.go | 4 ++-- private/bufpkg/bufmodule/commit_key.go | 6 +++--- private/bufpkg/bufmodule/errors.go | 4 ++-- private/bufpkg/bufmodule/module.go | 6 +++--- private/bufpkg/bufmodule/module_key.go | 6 +++--- private/bufpkg/bufmodule/module_set.go | 4 ++-- private/bufpkg/bufmodule/module_set_builder.go | 4 ++-- private/bufpkg/bufmodule/registry_commit_id.go | 2 +- private/bufpkg/bufprotosource/bufprotosource.go | 2 +- private/pkg/uuidutil/uuidutil.go | 6 +++--- 45 files changed, 63 insertions(+), 62 deletions(-) diff --git a/go.mod b/go.mod index 01d3ae1835..1086232677 100644 --- a/go.mod +++ b/go.mod @@ -20,10 +20,10 @@ require ( github.com/docker/docker v27.3.1+incompatible github.com/go-chi/chi/v5 v5.1.0 github.com/gofrs/flock v0.12.1 - github.com/gofrs/uuid/v5 v5.3.0 github.com/google/cel-go v0.21.0 github.com/google/go-cmp v0.6.0 github.com/google/go-containerregistry v0.20.2 + github.com/google/uuid v1.6.0 github.com/jdx/go-netrc v1.0.0 github.com/jhump/protoreflect/v2 v2.0.0-beta.2 github.com/klauspost/compress v1.17.10 @@ -86,7 +86,6 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/pprof v0.0.0-20240929191954-255acd752d31 // indirect - github.com/google/uuid v1.6.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect diff --git a/go.sum b/go.sum index 633cb1b21d..4414be29af 100644 --- a/go.sum +++ b/go.sum @@ -115,8 +115,6 @@ github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6Wezm github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY= github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0= -github.com/gofrs/uuid/v5 v5.3.0 h1:m0mUMr+oVYUdxpMLgSYCZiXe7PuVPnI94+OMeVBNedk= -github.com/gofrs/uuid/v5 v5.3.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/private/buf/bufconvert/bufconvert_test.go b/private/buf/bufconvert/bufconvert_test.go index e5c17bc159..37e847e7a2 100644 --- a/private/buf/bufconvert/bufconvert_test.go +++ b/private/buf/bufconvert/bufconvert_test.go @@ -19,7 +19,7 @@ import ( "testing" "github.com/bufbuild/buf/private/bufpkg/bufimage" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/protobuf/proto" diff --git a/private/buf/bufgen/features_test.go b/private/buf/bufgen/features_test.go index 8a3182d720..3f7eb73bcf 100644 --- a/private/buf/bufgen/features_test.go +++ b/private/buf/bufgen/features_test.go @@ -20,7 +20,7 @@ import ( "github.com/bufbuild/buf/private/bufpkg/bufconfig" "github.com/bufbuild/buf/private/bufpkg/bufimage" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/zap" diff --git a/private/buf/buflsp/file.go b/private/buf/buflsp/file.go index 271b0e728c..74158f2628 100644 --- a/private/buf/buflsp/file.go +++ b/private/buf/buflsp/file.go @@ -38,7 +38,7 @@ import ( "github.com/bufbuild/protocompile/parser" "github.com/bufbuild/protocompile/protoutil" "github.com/bufbuild/protocompile/reporter" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "go.lsp.dev/protocol" "go.opentelemetry.io/otel/attribute" "go.uber.org/zap" diff --git a/private/buf/bufmigrate/migrate_builder.go b/private/buf/bufmigrate/migrate_builder.go index 8e4c6136d1..34b6485a61 100644 --- a/private/buf/bufmigrate/migrate_builder.go +++ b/private/buf/bufmigrate/migrate_builder.go @@ -29,7 +29,7 @@ import ( "github.com/bufbuild/buf/private/pkg/stringutil" "github.com/bufbuild/buf/private/pkg/syserror" "github.com/bufbuild/buf/private/pkg/tracing" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "go.uber.org/multierr" "go.uber.org/zap" ) diff --git a/private/buf/bufmigrate/migrator.go b/private/buf/bufmigrate/migrator.go index 586ed1c6a3..761f0787fd 100644 --- a/private/buf/bufmigrate/migrator.go +++ b/private/buf/bufmigrate/migrator.go @@ -32,7 +32,7 @@ import ( "github.com/bufbuild/buf/private/pkg/storage" "github.com/bufbuild/buf/private/pkg/storage/storagemem" "github.com/bufbuild/buf/private/pkg/tracing" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "go.uber.org/multierr" "go.uber.org/zap" ) diff --git a/private/buf/bufworkspace/workspace_provider.go b/private/buf/bufworkspace/workspace_provider.go index fe0dbf8d20..1bf0033833 100644 --- a/private/buf/bufworkspace/workspace_provider.go +++ b/private/buf/bufworkspace/workspace_provider.go @@ -29,7 +29,7 @@ import ( "github.com/bufbuild/buf/private/pkg/stringutil" "github.com/bufbuild/buf/private/pkg/syserror" "github.com/bufbuild/buf/private/pkg/tracing" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "go.uber.org/zap" ) diff --git a/private/buf/cmd/buf/command/dep/depgraph/depgraph.go b/private/buf/cmd/buf/command/dep/depgraph/depgraph.go index f9a54b536a..0fcdbede51 100644 --- a/private/buf/cmd/buf/command/dep/depgraph/depgraph.go +++ b/private/buf/cmd/buf/command/dep/depgraph/depgraph.go @@ -30,6 +30,7 @@ import ( "github.com/bufbuild/buf/private/pkg/slicesext" "github.com/bufbuild/buf/private/pkg/stringutil" "github.com/bufbuild/buf/private/pkg/uuidutil" + "github.com/google/uuid" "github.com/spf13/pflag" ) @@ -225,7 +226,7 @@ func moduleFullNameOrOpaqueID(module bufmodule.Module) string { // dashlessCommitIDStringForModule returns the dashless UUID for the commit. If no commit // is set, we return an empty string. func dashlessCommitIDStringForModule(module bufmodule.Module) string { - if commitID := module.CommitID(); !commitID.IsNil() { + if commitID := module.CommitID(); commitID != uuid.Nil { return uuidutil.ToDashless(commitID) } return "" diff --git a/private/buf/cmd/buf/command/lsfiles/lsfiles.go b/private/buf/cmd/buf/command/lsfiles/lsfiles.go index 2ffee8d723..663a4e62cf 100644 --- a/private/buf/cmd/buf/command/lsfiles/lsfiles.go +++ b/private/buf/cmd/buf/command/lsfiles/lsfiles.go @@ -31,6 +31,7 @@ import ( "github.com/bufbuild/buf/private/pkg/slicesext" "github.com/bufbuild/buf/private/pkg/stringutil" "github.com/bufbuild/buf/private/pkg/uuidutil" + "github.com/google/uuid" "github.com/spf13/pflag" ) @@ -265,7 +266,7 @@ func newExternalImageFileInfo(imageFileInfo bufimage.ImageFileInfo) *externalIma module = moduleFullName.String() } var commit string - if commitID := imageFileInfo.CommitID(); !commitID.IsNil() { + if commitID := imageFileInfo.CommitID(); commitID != uuid.Nil { commit = uuidutil.ToDashless(commitID) } return &externalImageFileInfo{ diff --git a/private/buf/cmd/protoc-gen-buf-lint/lint_test.go b/private/buf/cmd/protoc-gen-buf-lint/lint_test.go index 531c21d563..5aa72639f2 100644 --- a/private/buf/cmd/protoc-gen-buf-lint/lint_test.go +++ b/private/buf/cmd/protoc-gen-buf-lint/lint_test.go @@ -28,7 +28,7 @@ import ( "github.com/bufbuild/buf/private/pkg/prototesting" "github.com/bufbuild/buf/private/pkg/stringutil" "github.com/bufbuild/protoplugin" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stretchr/testify/require" "google.golang.org/protobuf/types/pluginpb" ) diff --git a/private/bufpkg/bufcheck/bufcheckserver/internal/bufcheckserverutil/input_file.go b/private/bufpkg/bufcheck/bufcheckserver/internal/bufcheckserverutil/input_file.go index 2e63c49105..d1f15093ee 100644 --- a/private/bufpkg/bufcheck/bufcheckserver/internal/bufcheckserverutil/input_file.go +++ b/private/bufpkg/bufcheck/bufcheckserver/internal/bufcheckserverutil/input_file.go @@ -17,7 +17,7 @@ package bufcheckserverutil import ( "buf.build/go/bufplugin/descriptor" "github.com/bufbuild/buf/private/bufpkg/bufmodule" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" ) type inputFile struct { diff --git a/private/bufpkg/bufconfig/buf_lock_file.go b/private/bufpkg/bufconfig/buf_lock_file.go index fb43bdb2f1..ace54fd8e5 100644 --- a/private/bufpkg/bufconfig/buf_lock_file.go +++ b/private/bufpkg/bufconfig/buf_lock_file.go @@ -29,7 +29,7 @@ import ( "github.com/bufbuild/buf/private/pkg/storage" "github.com/bufbuild/buf/private/pkg/syserror" "github.com/bufbuild/buf/private/pkg/uuidutil" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" ) const ( @@ -457,7 +457,7 @@ func validateV1AndV1Beta1DepsHaveCommits(bufLockFile BufLockFile) error { switch fileVersion := bufLockFile.FileVersion(); fileVersion { case FileVersionV1Beta1, FileVersionV1: for _, depModuleKey := range bufLockFile.DepModuleKeys() { - if depModuleKey.CommitID().IsNil() { + if depModuleKey.CommitID() == uuid.Nil { // This is a system error. return syserror.Newf( "%s lock files require commits, however we did not have a commit for module %q", diff --git a/private/bufpkg/bufimage/bufimage.go b/private/bufpkg/bufimage/bufimage.go index fa8c0de8af..09b40187c5 100644 --- a/private/bufpkg/bufimage/bufimage.go +++ b/private/bufpkg/bufimage/bufimage.go @@ -34,7 +34,7 @@ import ( "github.com/bufbuild/buf/private/pkg/syserror" "github.com/bufbuild/buf/private/pkg/tracing" "github.com/bufbuild/buf/private/pkg/uuidutil" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" "google.golang.org/protobuf/types/pluginpb" @@ -57,7 +57,7 @@ type ImageFileInfo interface { // if the ImageFile came from a Module (as opposed to a serialized Protobuf message), and // if the CommitID was known.. // - // May be empty, that is CommitID().IsNil() may be true. Callers should not rely on this + // May be empty, that is CommitID() == uuid.Nil may be true. Callers should not rely on this // value being present. If ModuleFullName is nil, this will always be empty. CommitID() uuid.UUID // Imports returns the imports for this ImageFile. diff --git a/private/bufpkg/bufimage/bufimagemodify/bufimagemodify_test.go b/private/bufpkg/bufimage/bufimagemodify/bufimagemodify_test.go index 0bfa5c3795..d87947d304 100644 --- a/private/bufpkg/bufimage/bufimagemodify/bufimagemodify_test.go +++ b/private/bufpkg/bufimage/bufimagemodify/bufimagemodify_test.go @@ -26,7 +26,7 @@ import ( "github.com/bufbuild/buf/private/bufpkg/bufmodule" "github.com/bufbuild/buf/private/bufpkg/bufmodule/bufmoduletesting" "github.com/bufbuild/buf/private/pkg/tracing" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/require" "google.golang.org/protobuf/proto" diff --git a/private/bufpkg/bufimage/bufimagetesting/bufimagetesting.go b/private/bufpkg/bufimage/bufimagetesting/bufimagetesting.go index adcbc4df68..f18e740e72 100644 --- a/private/bufpkg/bufimage/bufimagetesting/bufimagetesting.go +++ b/private/bufpkg/bufimage/bufimagetesting/bufimagetesting.go @@ -21,7 +21,7 @@ import ( "github.com/bufbuild/buf/private/bufpkg/bufmodule" imagev1 "github.com/bufbuild/buf/private/gen/proto/go/buf/alpha/image/v1" "github.com/bufbuild/buf/private/pkg/protodescriptor" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/protobuf/proto" diff --git a/private/bufpkg/bufimage/bufimagetesting/bufimagetesting_test.go b/private/bufpkg/bufimage/bufimagetesting/bufimagetesting_test.go index fca33cf987..6581e5a938 100644 --- a/private/bufpkg/bufimage/bufimagetesting/bufimagetesting_test.go +++ b/private/bufpkg/bufimage/bufimagetesting/bufimagetesting_test.go @@ -23,7 +23,7 @@ import ( "github.com/bufbuild/buf/private/gen/data/datawkt" imagev1 "github.com/bufbuild/buf/private/gen/proto/go/buf/alpha/image/v1" "github.com/bufbuild/buf/private/pkg/slicesext" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/require" "google.golang.org/protobuf/proto" diff --git a/private/bufpkg/bufimage/bufimageutil/bufimageutil_test.go b/private/bufpkg/bufimage/bufimageutil/bufimageutil_test.go index 13b4d17b4d..6efbc80733 100644 --- a/private/bufpkg/bufimage/bufimageutil/bufimageutil_test.go +++ b/private/bufpkg/bufimage/bufimageutil/bufimageutil_test.go @@ -29,7 +29,7 @@ import ( "github.com/bufbuild/buf/private/pkg/storage" "github.com/bufbuild/buf/private/pkg/storage/storageos" "github.com/bufbuild/buf/private/pkg/tracing" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jhump/protoreflect/v2/protoprint" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/private/bufpkg/bufimage/image.go b/private/bufpkg/bufimage/image.go index 8e94f5f782..0de02f1378 100644 --- a/private/bufpkg/bufimage/image.go +++ b/private/bufpkg/bufimage/image.go @@ -20,7 +20,7 @@ import ( "github.com/bufbuild/buf/private/pkg/protoencoding" "github.com/bufbuild/buf/private/pkg/uuidutil" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "google.golang.org/protobuf/types/descriptorpb" ) diff --git a/private/bufpkg/bufimage/image_file.go b/private/bufpkg/bufimage/image_file.go index 7b92e165ea..32aacd85e4 100644 --- a/private/bufpkg/bufimage/image_file.go +++ b/private/bufpkg/bufimage/image_file.go @@ -18,7 +18,7 @@ import ( "github.com/bufbuild/buf/private/bufpkg/bufmodule" "github.com/bufbuild/buf/private/pkg/protodescriptor" "github.com/bufbuild/buf/private/pkg/slicesext" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "google.golang.org/protobuf/types/descriptorpb" ) diff --git a/private/bufpkg/bufimage/module_image_file_info.go b/private/bufpkg/bufimage/module_image_file_info.go index 4706d02a7d..a4905e2858 100644 --- a/private/bufpkg/bufimage/module_image_file_info.go +++ b/private/bufpkg/bufimage/module_image_file_info.go @@ -16,7 +16,7 @@ package bufimage import ( "github.com/bufbuild/buf/private/bufpkg/bufmodule" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" ) type moduleImageFileInfo struct { diff --git a/private/bufpkg/bufimage/parser_accessor_handler.go b/private/bufpkg/bufimage/parser_accessor_handler.go index d8c3919d1c..496f781689 100644 --- a/private/bufpkg/bufimage/parser_accessor_handler.go +++ b/private/bufpkg/bufimage/parser_accessor_handler.go @@ -24,7 +24,7 @@ import ( "github.com/bufbuild/buf/private/bufpkg/bufmodule" "github.com/bufbuild/buf/private/gen/data/datawkt" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "go.uber.org/multierr" ) @@ -159,7 +159,7 @@ func (p *parserAccessorHandler) addPath( if moduleFullName != nil { p.pathToModuleFullName[path] = moduleFullName } - if !commitID.IsNil() { + if commitID != uuid.Nil { p.pathToCommitID[path] = commitID } return nil diff --git a/private/bufpkg/bufimage/util.go b/private/bufpkg/bufimage/util.go index 1880f3297a..a6eb391652 100644 --- a/private/bufpkg/bufimage/util.go +++ b/private/bufpkg/bufimage/util.go @@ -25,6 +25,7 @@ import ( "github.com/bufbuild/buf/private/pkg/slicesext" "github.com/bufbuild/buf/private/pkg/uuidutil" "github.com/bufbuild/protoplugin/protopluginutil" + "github.com/google/uuid" "google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" @@ -302,7 +303,7 @@ func imageFilesToFileDescriptorProtos(imageFiles []ImageFile) []*descriptorpb.Fi func imageFileToProtoImageFile(imageFile ImageFile) (*imagev1.ImageFile, error) { var protoCommitID string - if !imageFile.CommitID().IsNil() { + if imageFile.CommitID() != uuid.Nil { protoCommitID = uuidutil.ToDashless(imageFile.CommitID()) } return fileDescriptorProtoToProtoImageFile( diff --git a/private/bufpkg/bufimage/well_known_type_image_file_info.go b/private/bufpkg/bufimage/well_known_type_image_file_info.go index d97ee1508c..d6a4c0007c 100644 --- a/private/bufpkg/bufimage/well_known_type_image_file_info.go +++ b/private/bufpkg/bufimage/well_known_type_image_file_info.go @@ -17,7 +17,7 @@ package bufimage import ( "github.com/bufbuild/buf/private/bufpkg/bufmodule" "github.com/bufbuild/buf/private/pkg/storage" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" ) type wellKnownTypeImageFileInfo struct { diff --git a/private/bufpkg/bufmodule/added_module.go b/private/bufpkg/bufmodule/added_module.go index 03bbe21301..7e54692309 100644 --- a/private/bufpkg/bufmodule/added_module.go +++ b/private/bufpkg/bufmodule/added_module.go @@ -24,7 +24,7 @@ import ( "github.com/bufbuild/buf/private/pkg/slicesext" "github.com/bufbuild/buf/private/pkg/storage" "github.com/bufbuild/buf/private/pkg/syserror" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" ) // addedModule represents a Module that was added in moduleSetBuilder. diff --git a/private/bufpkg/bufmodule/bufmoduleapi/commit_provider.go b/private/bufpkg/bufmodule/bufmoduleapi/commit_provider.go index 2d2bdb78e1..464a6cb418 100644 --- a/private/bufpkg/bufmodule/bufmoduleapi/commit_provider.go +++ b/private/bufpkg/bufmodule/bufmoduleapi/commit_provider.go @@ -23,7 +23,7 @@ import ( "github.com/bufbuild/buf/private/pkg/slicesext" "github.com/bufbuild/buf/private/pkg/syserror" "github.com/bufbuild/buf/private/pkg/uuidutil" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "go.uber.org/zap" ) diff --git a/private/bufpkg/bufmodule/bufmoduleapi/convert.go b/private/bufpkg/bufmodule/bufmoduleapi/convert.go index 78f7a95154..30906500cb 100644 --- a/private/bufpkg/bufmodule/bufmoduleapi/convert.go +++ b/private/bufpkg/bufmodule/bufmoduleapi/convert.go @@ -26,7 +26,7 @@ import ( "github.com/bufbuild/buf/private/pkg/slicesext" "github.com/bufbuild/buf/private/pkg/storage" "github.com/bufbuild/buf/private/pkg/uuidutil" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" ) var ( diff --git a/private/bufpkg/bufmodule/bufmoduleapi/digest_for_commit_id.go b/private/bufpkg/bufmodule/bufmoduleapi/digest_for_commit_id.go index f4e013b9ea..272785060a 100644 --- a/private/bufpkg/bufmodule/bufmoduleapi/digest_for_commit_id.go +++ b/private/bufpkg/bufmodule/bufmoduleapi/digest_for_commit_id.go @@ -19,7 +19,7 @@ import ( "github.com/bufbuild/buf/private/bufpkg/bufapi" "github.com/bufbuild/buf/private/bufpkg/bufmodule" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" ) // DigestForCommitID resolves the commit ID by calling the CommitService to get diff --git a/private/bufpkg/bufmodule/bufmoduleapi/module_data_provider.go b/private/bufpkg/bufmodule/bufmoduleapi/module_data_provider.go index 6af167d4ed..b4e8659f74 100644 --- a/private/bufpkg/bufmodule/bufmoduleapi/module_data_provider.go +++ b/private/bufpkg/bufmodule/bufmoduleapi/module_data_provider.go @@ -26,7 +26,7 @@ import ( "github.com/bufbuild/buf/private/pkg/storage" "github.com/bufbuild/buf/private/pkg/syserror" "github.com/bufbuild/buf/private/pkg/uuidutil" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "go.uber.org/zap" ) diff --git a/private/bufpkg/bufmodule/bufmoduleapi/universal_proto_commit.go b/private/bufpkg/bufmodule/bufmoduleapi/universal_proto_commit.go index 692ba09fba..1298a2b2b3 100644 --- a/private/bufpkg/bufmodule/bufmoduleapi/universal_proto_commit.go +++ b/private/bufpkg/bufmodule/bufmoduleapi/universal_proto_commit.go @@ -26,7 +26,7 @@ import ( "github.com/bufbuild/buf/private/bufpkg/bufmodule" "github.com/bufbuild/buf/private/pkg/slicesext" "github.com/bufbuild/buf/private/pkg/syserror" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" ) type universalProtoCommit struct { diff --git a/private/bufpkg/bufmodule/bufmoduleapi/universal_proto_content.go b/private/bufpkg/bufmodule/bufmoduleapi/universal_proto_content.go index c78deaadcf..660f439878 100644 --- a/private/bufpkg/bufmodule/bufmoduleapi/universal_proto_content.go +++ b/private/bufpkg/bufmodule/bufmoduleapi/universal_proto_content.go @@ -25,7 +25,7 @@ import ( "github.com/bufbuild/buf/private/bufpkg/bufmodule" "github.com/bufbuild/buf/private/pkg/slicesext" "github.com/bufbuild/buf/private/pkg/syserror" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" ) type universalProtoContent struct { diff --git a/private/bufpkg/bufmodule/bufmoduleapi/uploader.go b/private/bufpkg/bufmodule/bufmoduleapi/uploader.go index 6257985ca4..89d298280a 100644 --- a/private/bufpkg/bufmodule/bufmoduleapi/uploader.go +++ b/private/bufpkg/bufmodule/bufmoduleapi/uploader.go @@ -29,6 +29,7 @@ import ( "github.com/bufbuild/buf/private/pkg/slicesext" "github.com/bufbuild/buf/private/pkg/syserror" "github.com/bufbuild/buf/private/pkg/uuidutil" + "github.com/google/uuid" "go.uber.org/zap" ) @@ -494,7 +495,7 @@ func remoteDepToV1Beta1ProtoUploadRequestDepRef( return nil, syserror.Newf("expected module name for remote module dependency %q", remoteDep.OpaqueID()) } depCommitID := remoteDep.CommitID() - if depCommitID.IsNil() { + if depCommitID == uuid.Nil { return nil, syserror.Newf("did not have a commit ID for a remote module dependency %q", remoteDep.OpaqueID()) } return &modulev1beta1.UploadRequest_DepRef{ diff --git a/private/bufpkg/bufmodule/bufmodulecache/base_provider.go b/private/bufpkg/bufmodule/bufmodulecache/base_provider.go index 37103e8e52..384c048977 100644 --- a/private/bufpkg/bufmodule/bufmodulecache/base_provider.go +++ b/private/bufpkg/bufmodule/bufmodulecache/base_provider.go @@ -21,7 +21,7 @@ import ( "github.com/bufbuild/buf/private/pkg/slicesext" "github.com/bufbuild/buf/private/pkg/syserror" "github.com/bufbuild/buf/private/pkg/uuidutil" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "go.uber.org/zap" ) diff --git a/private/bufpkg/bufmodule/bufmodulecache/commit_provider.go b/private/bufpkg/bufmodule/bufmodulecache/commit_provider.go index 882144f6a3..27712ed8a5 100644 --- a/private/bufpkg/bufmodule/bufmodulecache/commit_provider.go +++ b/private/bufpkg/bufmodule/bufmodulecache/commit_provider.go @@ -19,7 +19,7 @@ import ( "github.com/bufbuild/buf/private/bufpkg/bufmodule" "github.com/bufbuild/buf/private/bufpkg/bufmodule/bufmodulestore" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "go.uber.org/zap" ) diff --git a/private/bufpkg/bufmodule/bufmodulecache/module_data_provider.go b/private/bufpkg/bufmodule/bufmodulecache/module_data_provider.go index 894f4d740e..350bcea06e 100644 --- a/private/bufpkg/bufmodule/bufmodulecache/module_data_provider.go +++ b/private/bufpkg/bufmodule/bufmodulecache/module_data_provider.go @@ -19,7 +19,7 @@ import ( "github.com/bufbuild/buf/private/bufpkg/bufmodule" "github.com/bufbuild/buf/private/bufpkg/bufmodule/bufmodulestore" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "go.uber.org/zap" ) diff --git a/private/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting.go b/private/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting.go index 5f1b270fda..87a01b7690 100644 --- a/private/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting.go +++ b/private/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting.go @@ -30,7 +30,7 @@ import ( "github.com/bufbuild/buf/private/pkg/storage/storageos" "github.com/bufbuild/buf/private/pkg/tracing" "github.com/bufbuild/buf/private/pkg/uuidutil" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" ) var ( @@ -420,7 +420,7 @@ func addModuleDataToModuleSetBuilder( return err } commitID := moduleData.CommitID - if commitID.IsNil() { + if commitID == uuid.Nil { commitID, err = uuidutil.New() if err != nil { return err diff --git a/private/bufpkg/bufmodule/commit_key.go b/private/bufpkg/bufmodule/commit_key.go index 69668b717e..b24f027675 100644 --- a/private/bufpkg/bufmodule/commit_key.go +++ b/private/bufpkg/bufmodule/commit_key.go @@ -22,7 +22,7 @@ import ( "github.com/bufbuild/buf/private/pkg/slicesext" "github.com/bufbuild/buf/private/pkg/syserror" "github.com/bufbuild/buf/private/pkg/uuidutil" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" ) // CommitKey provides identifying information for a Commit when calling the CommitProvider. @@ -38,7 +38,7 @@ type CommitKey interface { // // It is up to the caller to convert this to a dashless ID when necessary. // - // Always present, that is CommitID().IsNil() will always be false. + // Always present, that is CommitID() == uuid.Nil will always be false. CommitID() uuid.UUID // DigestType returns the DigestType of the Commit. // @@ -102,7 +102,7 @@ func newCommitKey( if registry == "" { return nil, errors.New("empty registry when constructing CommitKey") } - if commitID.IsNil() { + if commitID == uuid.Nil { return nil, errors.New("empty commitID when constructing CommitKey") } if _, ok := digestTypeToString[digestType]; !ok { diff --git a/private/bufpkg/bufmodule/errors.go b/private/bufpkg/bufmodule/errors.go index 0f2732a671..50653225fb 100644 --- a/private/bufpkg/bufmodule/errors.go +++ b/private/bufpkg/bufmodule/errors.go @@ -20,7 +20,7 @@ import ( "strings" "github.com/bufbuild/buf/private/pkg/uuidutil" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" ) var ( @@ -238,7 +238,7 @@ func (m *DigestMismatchError) Error() string { if m.ModuleFullName != nil { _, _ = builder.WriteString(` for "`) _, _ = builder.WriteString(m.ModuleFullName.String()) - if !m.CommitID.IsNil() { + if m.CommitID != uuid.Nil { _, _ = builder.WriteString(`:`) _, _ = builder.WriteString(uuidutil.ToDashless(m.CommitID)) } diff --git a/private/bufpkg/bufmodule/module.go b/private/bufpkg/bufmodule/module.go index ab639870cd..408dad2b54 100644 --- a/private/bufpkg/bufmodule/module.go +++ b/private/bufpkg/bufmodule/module.go @@ -22,7 +22,7 @@ import ( "github.com/bufbuild/buf/private/pkg/slicesext" "github.com/bufbuild/buf/private/pkg/storage" "github.com/bufbuild/buf/private/pkg/syserror" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" ) // Module presents a BSR module. @@ -83,7 +83,7 @@ type Module interface { // // It is up to the caller to convert this to a dashless ID when necessary. // - // May be empty, that is CommitID().IsNil() may be true. + // May be empty, that is CommitID() == uuid.Nil may be true. // Callers should not rely on this value being present. // // If ModuleFullName is nil, this will always be empty. @@ -279,7 +279,7 @@ func newModule( if !isLocal && moduleFullName == nil { return nil, syserror.New("moduleFullName not present when constructing a remote Module") } - if moduleFullName == nil && !commitID.IsNil() { + if moduleFullName == nil && commitID != uuid.Nil { return nil, syserror.New("moduleFullName not present and commitID present when constructing a remote Module") } diff --git a/private/bufpkg/bufmodule/module_key.go b/private/bufpkg/bufmodule/module_key.go index 0fc25149ae..73241bb9e1 100644 --- a/private/bufpkg/bufmodule/module_key.go +++ b/private/bufpkg/bufmodule/module_key.go @@ -23,7 +23,7 @@ import ( "github.com/bufbuild/buf/private/pkg/slicesext" "github.com/bufbuild/buf/private/pkg/syserror" "github.com/bufbuild/buf/private/pkg/uuidutil" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" ) // ModuleKey provides identifying information for a Module. @@ -43,7 +43,7 @@ type ModuleKey interface { // // It is up to the caller to convert this to a dashless ID when necessary. // - // Always present, that is CommitID().IsNil() will always be false. + // Always present, that is CommitID() == uuid.Nil will always be false. CommitID() uuid.UUID // Digest returns the Module digest. // @@ -127,7 +127,7 @@ func newModuleKey( if moduleFullName == nil { return nil, errors.New("nil ModuleFullName when constructing ModuleKey") } - if commitID.IsNil() { + if commitID == uuid.Nil { return nil, errors.New("empty commitID when constructing ModuleKey") } return newModuleKeyNoValidate(moduleFullName, commitID, getDigest), nil diff --git a/private/bufpkg/bufmodule/module_set.go b/private/bufpkg/bufmodule/module_set.go index 400b953909..dda3066c58 100644 --- a/private/bufpkg/bufmodule/module_set.go +++ b/private/bufpkg/bufmodule/module_set.go @@ -26,7 +26,7 @@ import ( "github.com/bufbuild/buf/private/pkg/syserror" "github.com/bufbuild/buf/private/pkg/tracing" "github.com/bufbuild/buf/private/pkg/uuidutil" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" ) // ModuleSet is a set of Modules constructed by a ModuleBuilder. @@ -299,7 +299,7 @@ func newModuleSet( bucketIDToModule[bucketID] = module } commitID := module.CommitID() - if !commitID.IsNil() { + if commitID != uuid.Nil { if _, ok := commitIDToModule[commitID]; ok { // This should never happen. return nil, syserror.Newf("duplicate CommitID %q when constructing ModuleSet", uuidutil.ToDashless(commitID)) diff --git a/private/bufpkg/bufmodule/module_set_builder.go b/private/bufpkg/bufmodule/module_set_builder.go index c3a3bc2575..19b5c35618 100644 --- a/private/bufpkg/bufmodule/module_set_builder.go +++ b/private/bufpkg/bufmodule/module_set_builder.go @@ -23,7 +23,7 @@ import ( "github.com/bufbuild/buf/private/pkg/storage" "github.com/bufbuild/buf/private/pkg/syserror" "github.com/bufbuild/buf/private/pkg/tracing" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "go.uber.org/multierr" ) @@ -318,7 +318,7 @@ func (b *moduleSetBuilder) AddLocalModule( for _, option := range options { option(localModuleOptions) } - if localModuleOptions.moduleFullName == nil && !localModuleOptions.commitID.IsNil() { + if localModuleOptions.moduleFullName == nil && localModuleOptions.commitID != uuid.Nil { return b.addError(syserror.New("cannot set commitID without ModuleFullName when calling AddLocalModule")) } if !isTarget && (len(localModuleOptions.targetPaths) > 0 || len(localModuleOptions.targetExcludePaths) > 0) { diff --git a/private/bufpkg/bufmodule/registry_commit_id.go b/private/bufpkg/bufmodule/registry_commit_id.go index 35453b8333..b6d3fa548c 100644 --- a/private/bufpkg/bufmodule/registry_commit_id.go +++ b/private/bufpkg/bufmodule/registry_commit_id.go @@ -14,7 +14,7 @@ package bufmodule -import "github.com/gofrs/uuid/v5" +import "github.com/google/uuid" // RegistryCommitID is the pair of a Commit ID with the registry the commit belongs to. // diff --git a/private/bufpkg/bufprotosource/bufprotosource.go b/private/bufpkg/bufprotosource/bufprotosource.go index 1e9b709648..664225812e 100644 --- a/private/bufpkg/bufprotosource/bufprotosource.go +++ b/private/bufpkg/bufprotosource/bufprotosource.go @@ -32,7 +32,7 @@ import ( "github.com/bufbuild/buf/private/bufpkg/bufmodule" "github.com/bufbuild/buf/private/pkg/normalpath" "github.com/bufbuild/buf/private/pkg/protodescriptor" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "google.golang.org/protobuf/reflect/protodesc" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/types/descriptorpb" diff --git a/private/pkg/uuidutil/uuidutil.go b/private/pkg/uuidutil/uuidutil.go index 332d4d646a..ced11bbc1f 100644 --- a/private/pkg/uuidutil/uuidutil.go +++ b/private/pkg/uuidutil/uuidutil.go @@ -17,12 +17,12 @@ package uuidutil import ( "fmt" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" ) // New returns a new random UUIDv4. func New() (uuid.UUID, error) { - id, err := uuid.NewV4() + id, err := uuid.NewRandom() if err != nil { return uuid.Nil, err } @@ -43,7 +43,7 @@ func FromString(s string) (uuid.UUID, error) { if len(s) != 36 { return uuid.Nil, fmt.Errorf("expected uuid to be of length 36 but was %d: %s", len(s), s) } - return uuid.FromString(s) + return uuid.Parse(s) } // FromDashless returns the dashless uuid with dashes.