Skip to content

Commit ed6926b

Browse files
alexandeardsnet
authored andcommitted
Fix typos in comments, tests and function names (#974)
1 parent 1680a47 commit ed6926b

File tree

10 files changed

+26
-26
lines changed

10 files changed

+26
-26
lines changed

jsonpb/jsonpb_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -584,36 +584,36 @@ func TestMarshalJSONPBMarshaler(t *testing.T) {
584584
msg := dynamicMessage{RawJson: rawJson}
585585
str, err := new(Marshaler).MarshalToString(&msg)
586586
if err != nil {
587-
t.Errorf("an unexpected error occurred when marshalling JSONPBMarshaler: %v", err)
587+
t.Errorf("an unexpected error occurred when marshaling JSONPBMarshaler: %v", err)
588588
}
589589
if str != rawJson {
590-
t.Errorf("marshalling JSON produced incorrect output: got %s, wanted %s", str, rawJson)
590+
t.Errorf("marshaling JSON produced incorrect output: got %s, wanted %s", str, rawJson)
591591
}
592592
}
593593

594594
func TestMarshalAnyJSONPBMarshaler(t *testing.T) {
595595
msg := dynamicMessage{RawJson: `{ "foo": "bar", "baz": [0, 1, 2, 3] }`}
596596
a, err := ptypes.MarshalAny(&msg)
597597
if err != nil {
598-
t.Errorf("an unexpected error occurred when marshalling to Any: %v", err)
598+
t.Errorf("an unexpected error occurred when marshaling to Any: %v", err)
599599
}
600600
str, err := new(Marshaler).MarshalToString(a)
601601
if err != nil {
602-
t.Errorf("an unexpected error occurred when marshalling Any to JSON: %v", err)
602+
t.Errorf("an unexpected error occurred when marshaling Any to JSON: %v", err)
603603
}
604604
// after custom marshaling, it's round-tripped through JSON decoding/encoding already,
605605
// so the keys are sorted, whitespace is compacted, and "@type" key has been added
606606
expected := `{"@type":"type.googleapis.com/` + dynamicMessageName + `","baz":[0,1,2,3],"foo":"bar"}`
607607
if str != expected {
608-
t.Errorf("marshalling JSON produced incorrect output: got %s, wanted %s", str, expected)
608+
t.Errorf("marshaling JSON produced incorrect output: got %s, wanted %s", str, expected)
609609
}
610610

611611
// Do it again, but this time with indentation:
612612

613613
marshaler := Marshaler{Indent: " "}
614614
str, err = marshaler.MarshalToString(a)
615615
if err != nil {
616-
t.Errorf("an unexpected error occurred when marshalling Any to JSON: %v", err)
616+
t.Errorf("an unexpected error occurred when marshaling Any to JSON: %v", err)
617617
}
618618
// same as expected above, but pretty-printed w/ indentation
619619
expected = `{
@@ -627,7 +627,7 @@ func TestMarshalAnyJSONPBMarshaler(t *testing.T) {
627627
"foo": "bar"
628628
}`
629629
if str != expected {
630-
t.Errorf("marshalling JSON produced incorrect output: got %s, wanted %s", str, expected)
630+
t.Errorf("marshaling JSON produced incorrect output: got %s, wanted %s", str, expected)
631631
}
632632
}
633633

@@ -636,11 +636,11 @@ func TestMarshalWithCustomValidation(t *testing.T) {
636636

637637
js, err := new(Marshaler).MarshalToString(&msg)
638638
if err != nil {
639-
t.Errorf("an unexpected error occurred when marshalling to json: %v", err)
639+
t.Errorf("an unexpected error occurred when marshaling to json: %v", err)
640640
}
641641
err = Unmarshal(strings.NewReader(js), &msg)
642642
if err != nil {
643-
t.Errorf("an unexpected error occurred when unmarshalling from json: %v", err)
643+
t.Errorf("an unexpected error occurred when unmarshaling from json: %v", err)
644644
}
645645
}
646646

@@ -883,7 +883,7 @@ func TestUnmarshaling(t *testing.T) {
883883

884884
err := tt.unmarshaler.Unmarshal(strings.NewReader(tt.json), p)
885885
if err != nil {
886-
t.Errorf("unmarshalling %s: %v", tt.desc, err)
886+
t.Errorf("unmarshaling %s: %v", tt.desc, err)
887887
continue
888888
}
889889

@@ -1017,7 +1017,7 @@ func TestAnyWithCustomResolver(t *testing.T) {
10171017
}
10181018
wanted := `{"@type":"https://foobar.com/some.random.MessageKind","oBool":true,"oInt64":"1020304","oString":"foobar","oBytes":"AQIDBA=="}`
10191019
if js != wanted {
1020-
t.Errorf("marshalling JSON produced incorrect output: got %s, wanted %s", js, wanted)
1020+
t.Errorf("marshaling JSON produced incorrect output: got %s, wanted %s", js, wanted)
10211021
}
10221022

10231023
u := Unmarshaler{AnyResolver: resolver}
@@ -1032,7 +1032,7 @@ func TestAnyWithCustomResolver(t *testing.T) {
10321032
t.Errorf("custom resolver was invoked with wrong URL: got %q, wanted %q", resolvedTypeUrls[1], "https://foobar.com/some.random.MessageKind")
10331033
}
10341034
if !proto.Equal(any, roundTrip) {
1035-
t.Errorf("message contents not set correctly after unmarshalling JSON: got %s, wanted %s", roundTrip, any)
1035+
t.Errorf("message contents not set correctly after unmarshaling JSON: got %s, wanted %s", roundTrip, any)
10361036
}
10371037
}
10381038

@@ -1043,7 +1043,7 @@ func TestUnmarshalJSONPBUnmarshaler(t *testing.T) {
10431043
t.Errorf("an unexpected error occurred when parsing into JSONPBUnmarshaler: %v", err)
10441044
}
10451045
if msg.RawJson != rawJson {
1046-
t.Errorf("message contents not set correctly after unmarshalling JSON: got %s, wanted %s", msg.RawJson, rawJson)
1046+
t.Errorf("message contents not set correctly after unmarshaling JSON: got %s, wanted %s", msg.RawJson, rawJson)
10471047
}
10481048
}
10491049

@@ -1077,7 +1077,7 @@ func TestUnmarshalAnyJSONPBUnmarshaler(t *testing.T) {
10771077
}
10781078

10791079
if !proto.Equal(&got, &want) {
1080-
t.Errorf("message contents not set correctly after unmarshalling JSON: got %v, wanted %v", got, want)
1080+
t.Errorf("message contents not set correctly after unmarshaling JSON: got %v, wanted %v", got, want)
10811081
}
10821082
}
10831083

proto/all_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ func TestJSON(t *testing.T) {
15021502
t.Fatalf("got %s, want %s", received, m)
15031503
}
15041504

1505-
// Test unmarshalling of JSON with symbolic enum name.
1505+
// Test unmarshaling of JSON with symbolic enum name.
15061506
const old = `{"count":4,"pet":["bunny","kitty"],"inner":{"host":"cauchy"},"bikeshed":"GREEN"}`
15071507
received.Reset()
15081508
if err := json.Unmarshal([]byte(old), received); err != nil {

proto/encode_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ func BenchmarkAny(b *testing.B) {
7373
}
7474
}
7575

76-
// BenchmarkEmpy measures the overhead of doing the minimal possible encode.
77-
func BenchmarkEmpy(b *testing.B) {
76+
// BenchmarkEmpty measures the overhead of doing the minimal possible encode.
77+
func BenchmarkEmpty(b *testing.B) {
7878
for i := 0; i < b.N; i++ {
7979
raw, err := proto.Marshal(&tpb.Message{})
8080
if err != nil {

proto/extensions_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ func TestUnmarshalRepeatingNonRepeatedExtension(t *testing.T) {
590590
var want pb.ComplexExtension
591591

592592
// Generate a serialized representation of a repeated extension
593-
// by catenating bytes together.
593+
// by concatenating bytes together.
594594
for i, e := range test.ext {
595595
// Merge to create the wanted proto.
596596
proto.Merge(&want, e)

proto/lib.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ func (p *Buffer) Bytes() []byte { return p.buf }
393393
// than relying on this API.
394394
//
395395
// If deterministic serialization is requested, map entries will be sorted
396-
// by keys in lexographical order. This is an implementation detail and
396+
// by keys in lexicographical order. This is an implementation detail and
397397
// subject to change.
398398
func (p *Buffer) SetDeterministic(deterministic bool) {
399399
p.deterministic = deterministic

proto/map_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func TestMap(t *testing.T) {
3232
}
3333
}
3434

35-
func marshalled() []byte {
35+
func marshaled() []byte {
3636
m := &ppb.IntMaps{}
3737
for i := 0; i < 1000; i++ {
3838
m.Maps = append(m.Maps, &ppb.IntMap{
@@ -47,7 +47,7 @@ func marshalled() []byte {
4747
}
4848

4949
func BenchmarkConcurrentMapUnmarshal(b *testing.B) {
50-
in := marshalled()
50+
in := marshaled()
5151
b.RunParallel(func(pb *testing.PB) {
5252
for pb.Next() {
5353
var out ppb.IntMaps
@@ -59,7 +59,7 @@ func BenchmarkConcurrentMapUnmarshal(b *testing.B) {
5959
}
6060

6161
func BenchmarkSequentialMapUnmarshal(b *testing.B) {
62-
in := marshalled()
62+
in := marshaled()
6363
b.ResetTimer()
6464
for i := 0; i < b.N; i++ {
6565
var out ppb.IntMaps

protoc-gen-go/generator/generator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2062,7 +2062,7 @@ func (g *Generator) generateInternalStructFields(mc *msgCtx, topLevelFields []to
20622062

20632063
}
20642064

2065-
// generateOneofFuncs adds all the utility functions for oneof, including marshalling, unmarshalling and sizer.
2065+
// generateOneofFuncs adds all the utility functions for oneof, including marshaling, unmarshaling and sizer.
20662066
func (g *Generator) generateOneofFuncs(mc *msgCtx, topLevelFields []topLevelField) {
20672067
ofields := []*oneofField{}
20682068
for _, f := range topLevelFields {

protoc-gen-go/generator/internal/remap/remap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type Location struct {
4747
}
4848

4949
// A Map represents a mapping between token locations in an input source text
50-
// and locations in the correspnding output text.
50+
// and locations in the corresponding output text.
5151
type Map map[Location]Location
5252

5353
// Find reports whether the specified span is recorded by m, and if so returns

protoc-gen-go/grpc/grpc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi
226226
g.P("}")
227227
g.P()
228228

229-
// Server Unimplemented struct for forward compatability.
229+
// Server Unimplemented struct for forward compatibility.
230230
if deprecated {
231231
g.P(deprecationComment)
232232
}

protoc-gen-go/testdata/import_public_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import (
4141
)
4242

4343
func TestImportPublicLink(t *testing.T) {
44-
// mainpb.[ME] should be interchangable with subpb.[ME].
44+
// mainpb.[ME] should be interchangeable with subpb.[ME].
4545
var _ mainpb.M = subpb.M{}
4646
var _ mainpb.E = subpb.E(0)
4747
_ = &mainpb.Public{

0 commit comments

Comments
 (0)