From b151811851edc2e9178f2db780594ab1470bbd16 Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Fri, 4 Jun 2021 16:47:12 -0700 Subject: [PATCH] phonenumberutil: update package references Updates ttacon/libphonenumber#105. --- Gopkg.lock | 46 +++++++++++++++++++++++++++++++++-------- Gopkg.toml | 2 +- phonenumberutil.go | 14 ++++++------- phonenumberutil_test.go | 10 ++++----- 4 files changed, 50 insertions(+), 22 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index ff2ff43..66f95d6 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -1,14 +1,6 @@ # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. -[[projects]] - digest = "1:ffc060c551980d37ee9e428ef528ee2813137249ccebb0bfc412ef83071cac91" - name = "github.com/golang/protobuf" - packages = ["proto"] - pruneopts = "UT" - revision = "925541529c1fa6821df4e44ce2723319eb2be768" - version = "v1.0.0" - [[projects]] branch = "master" digest = "1:5a73b4e1f20bd3480321a24aace506204e87ef73f7dc2e23d21f24478e94cd34" @@ -17,12 +9,48 @@ pruneopts = "UT" revision = "c099f663e1c235176c175644792c5eb282017ad7" +[[projects]] + digest = "1:3ef4e465143a870872f10eb335d09da62dbd547bd81002124ed87f18cbfc26c6" + name = "google.golang.org/protobuf" + packages = [ + "encoding/prototext", + "encoding/protowire", + "internal/descfmt", + "internal/descopts", + "internal/detrand", + "internal/encoding/defval", + "internal/encoding/messageset", + "internal/encoding/tag", + "internal/encoding/text", + "internal/errors", + "internal/filedesc", + "internal/filetype", + "internal/flags", + "internal/genid", + "internal/impl", + "internal/order", + "internal/pragma", + "internal/set", + "internal/strs", + "internal/version", + "proto", + "reflect/protoreflect", + "reflect/protoregistry", + "runtime/protoiface", + "runtime/protoimpl", + ] + pruneopts = "UT" + revision = "f2d1f6cbe10b90d22296ea09a7217081c2798009" + version = "v1.26.0" + [solve-meta] analyzer-name = "dep" analyzer-version = 1 input-imports = [ - "github.com/golang/protobuf/proto", "github.com/ttacon/builder", + "google.golang.org/protobuf/proto", + "google.golang.org/protobuf/reflect/protoreflect", + "google.golang.org/protobuf/runtime/protoimpl", ] solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 6f41abe..701cfc2 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -26,7 +26,7 @@ [[constraint]] - name = "github.com/golang/protobuf" + name = "google.golang.org/protobuf" version = "1.0.0" [[constraint]] diff --git a/phonenumberutil.go b/phonenumberutil.go index 622aa7e..7a782fc 100644 --- a/phonenumberutil.go +++ b/phonenumberutil.go @@ -11,7 +11,7 @@ import ( "github.com/ttacon/builder" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" ) const ( @@ -2560,7 +2560,7 @@ func maybeExtractCountryCode( } potentialCountryCode := extractCountryCode(fullNumber, nationalNumber) if potentialCountryCode != 0 { - phoneNumber.CountryCode = proto.Int(potentialCountryCode) + phoneNumber.CountryCode = proto.Int32(int32(potentialCountryCode)) return potentialCountryCode, nil } @@ -2610,13 +2610,13 @@ func maybeExtractCountryCode( val := PhoneNumber_FROM_NUMBER_WITHOUT_PLUS_SIGN phoneNumber.CountryCodeSource = &val } - phoneNumber.CountryCode = proto.Int(defaultCountryCode) + phoneNumber.CountryCode = proto.Int32(int32(defaultCountryCode)) return defaultCountryCode, nil } } } // No country calling code present. - phoneNumber.CountryCode = proto.Int(0) + phoneNumber.CountryCode = proto.Int32(0) return 0, nil } @@ -2867,7 +2867,7 @@ func setItalianLeadingZerosForPhoneNumber( numLeadZeros++ } if numLeadZeros != 1 { - phoneNumber.NumberOfLeadingZeros = proto.Int(numLeadZeros) + phoneNumber.NumberOfLeadingZeros = proto.Int32(int32(numLeadZeros)) } } @@ -2958,7 +2958,7 @@ func parseHelper( normalizedNationalNumber.WriteString(normalize(nationalNumber.String())) if len(defaultRegion) != 0 { countryCode = int(regionMetadata.GetCountryCode()) - phoneNumber.CountryCode = proto.Int(countryCode) + phoneNumber.CountryCode = proto.Int32(int32(countryCode)) } else if keepRawInput { phoneNumber.CountryCodeSource = nil } @@ -3130,7 +3130,7 @@ func isNumberMatchWithNumbers(firstNumberIn, secondNumberIn *PhoneNumber) MatchT // Checks cases where one or both country_code fields were not // specified. To make equality checks easier, we first set the // country_code fields to be equal. - firstNumber.CountryCode = proto.Int(int(secondNumberCountryCode)) + firstNumber.CountryCode = proto.Int32(secondNumberCountryCode) // If all else was the same, then this is an NSN_MATCH. // TODO(ttacon): remove when make gen-equals if reflect.DeepEqual(firstNumber, secondNumber) { diff --git a/phonenumberutil_test.go b/phonenumberutil_test.go index af353c9..942becb 100644 --- a/phonenumberutil_test.go +++ b/phonenumberutil_test.go @@ -5,7 +5,7 @@ import ( "regexp" "testing" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" ) func TestParse(t *testing.T) { @@ -273,8 +273,8 @@ func Test_IsValidNumber(t *testing.T) { continue } if IsValidNumber(num) != test.isValid { - t.Errorf("[test %d:validity] failed: %v != %v\n", - i, IsValidNumber(num), test.isValid) + t.Errorf("[test %d:validity] failed: IsValidNumber(%v) = %v, want %v\n", + i, num, IsValidNumber(num), test.isValid) } } } @@ -566,9 +566,9 @@ var testPhoneNumbers = map[string]*PhoneNumber{ "UNKNOWN_COUNTRY_CODE_NO_RAW_INPUT": newPhoneNumber(2, 12345), } -func newPhoneNumber(cc int, natNum uint64) *PhoneNumber { +func newPhoneNumber(cc int32, natNum uint64) *PhoneNumber { p := &PhoneNumber{} - p.CountryCode = proto.Int(cc) + p.CountryCode = proto.Int32(cc) p.NationalNumber = proto.Uint64(natNum) return p }