Skip to content

Commit b044c2f

Browse files
committed
phonenumberutil: update package references
Updates #105.
1 parent f43c7eb commit b044c2f

File tree

4 files changed

+50
-22
lines changed

4 files changed

+50
-22
lines changed

Gopkg.lock

+37-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727

2828
[[constraint]]
29-
name = "github.com/golang/protobuf"
29+
name = "google.golang.org/protobuf"
3030
version = "1.0.0"
3131

3232
[[constraint]]

phonenumberutil.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
"github.com/ttacon/builder"
1313

14-
"github.com/golang/protobuf/proto"
14+
"google.golang.org/protobuf/proto"
1515
)
1616

1717
const (
@@ -2560,7 +2560,7 @@ func maybeExtractCountryCode(
25602560
}
25612561
potentialCountryCode := extractCountryCode(fullNumber, nationalNumber)
25622562
if potentialCountryCode != 0 {
2563-
phoneNumber.CountryCode = proto.Int(potentialCountryCode)
2563+
phoneNumber.CountryCode = proto.Int32(int32(potentialCountryCode))
25642564
return potentialCountryCode, nil
25652565
}
25662566

@@ -2610,13 +2610,13 @@ func maybeExtractCountryCode(
26102610
val := PhoneNumber_FROM_NUMBER_WITHOUT_PLUS_SIGN
26112611
phoneNumber.CountryCodeSource = &val
26122612
}
2613-
phoneNumber.CountryCode = proto.Int(defaultCountryCode)
2613+
phoneNumber.CountryCode = proto.Int32(int32(defaultCountryCode))
26142614
return defaultCountryCode, nil
26152615
}
26162616
}
26172617
}
26182618
// No country calling code present.
2619-
phoneNumber.CountryCode = proto.Int(0)
2619+
phoneNumber.CountryCode = proto.Int32(0)
26202620
return 0, nil
26212621
}
26222622

@@ -2867,7 +2867,7 @@ func setItalianLeadingZerosForPhoneNumber(
28672867
numLeadZeros++
28682868
}
28692869
if numLeadZeros != 1 {
2870-
phoneNumber.NumberOfLeadingZeros = proto.Int(numLeadZeros)
2870+
phoneNumber.NumberOfLeadingZeros = proto.Int32(int32(numLeadZeros))
28712871
}
28722872
}
28732873

@@ -2958,7 +2958,7 @@ func parseHelper(
29582958
normalizedNationalNumber.WriteString(normalize(nationalNumber.String()))
29592959
if len(defaultRegion) != 0 {
29602960
countryCode = int(regionMetadata.GetCountryCode())
2961-
phoneNumber.CountryCode = proto.Int(countryCode)
2961+
phoneNumber.CountryCode = proto.Int32(int32(countryCode))
29622962
} else if keepRawInput {
29632963
phoneNumber.CountryCodeSource = nil
29642964
}
@@ -3130,7 +3130,7 @@ func isNumberMatchWithNumbers(firstNumberIn, secondNumberIn *PhoneNumber) MatchT
31303130
// Checks cases where one or both country_code fields were not
31313131
// specified. To make equality checks easier, we first set the
31323132
// country_code fields to be equal.
3133-
firstNumber.CountryCode = proto.Int(int(secondNumberCountryCode))
3133+
firstNumber.CountryCode = proto.Int32(secondNumberCountryCode)
31343134
// If all else was the same, then this is an NSN_MATCH.
31353135
// TODO(ttacon): remove when make gen-equals
31363136
if reflect.DeepEqual(firstNumber, secondNumber) {

phonenumberutil_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"regexp"
66
"testing"
77

8-
"github.com/golang/protobuf/proto"
8+
"google.golang.org/protobuf/proto"
99
)
1010

1111
func TestParse(t *testing.T) {
@@ -273,8 +273,8 @@ func Test_IsValidNumber(t *testing.T) {
273273
continue
274274
}
275275
if IsValidNumber(num) != test.isValid {
276-
t.Errorf("[test %d:validity] failed: %v != %v\n",
277-
i, IsValidNumber(num), test.isValid)
276+
t.Errorf("[test %d:validity] failed: IsValidNumber(%v) = %v, want %v\n",
277+
i, num, IsValidNumber(num), test.isValid)
278278
}
279279
}
280280
}
@@ -566,9 +566,9 @@ var testPhoneNumbers = map[string]*PhoneNumber{
566566
"UNKNOWN_COUNTRY_CODE_NO_RAW_INPUT": newPhoneNumber(2, 12345),
567567
}
568568

569-
func newPhoneNumber(cc int, natNum uint64) *PhoneNumber {
569+
func newPhoneNumber(cc int32, natNum uint64) *PhoneNumber {
570570
p := &PhoneNumber{}
571-
p.CountryCode = proto.Int(cc)
571+
p.CountryCode = proto.Int32(cc)
572572
p.NationalNumber = proto.Uint64(natNum)
573573
return p
574574
}

0 commit comments

Comments
 (0)