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

Fix typos #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 encoding/protojson/fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ func roundTripAndCompareProto(t *testing.T, wireBytes []byte, messages ...proto.

jsonBytes, err := protojson.Marshal(src)
if err != nil {
t.Errorf("failed to marshal messsage to json: %v\nmessage: %v", err, src)
t.Errorf("failed to marshal message to json: %v\nmessage: %v", err, src)
}
dst := msg.ProtoReflect().Type().New().Interface()

if err := protojson.Unmarshal(jsonBytes, dst); err != nil {
t.Errorf("failed to unmarshal messsage from json: %v\njson: %s", err, jsonBytes)
t.Errorf("failed to unmarshal message from json: %v\njson: %s", err, jsonBytes)
}

// The cmp package does not deal with NaN on its own and will report
Expand Down
2 changes: 1 addition & 1 deletion encoding/protojson/well_known_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func wellKnownTypeMarshaler(name protoreflect.FullName) marshalFunc {

type unmarshalFunc func(decoder, protoreflect.Message) error

// wellKnownTypeUnmarshaler returns a unmarshal function if the message type
// wellKnownTypeUnmarshaler returns an unmarshal function if the message type
// has specialized serialization behavior. It returns nil otherwise.
func wellKnownTypeUnmarshaler(name protoreflect.FullName) unmarshalFunc {
if name.Parent() == genid.GoogleProtobuf_package {
Expand Down
4 changes: 2 additions & 2 deletions encoding/prototext/fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ func roundTripAndCompareProto(t *testing.T, wireBytes []byte, messages ...proto.

textFormat, err := prototext.Marshal(src)
if err != nil {
t.Errorf("failed to marshal messsage to text format: %v\nmessage: %v", err, src)
t.Errorf("failed to marshal message to text format: %v\nmessage: %v", err, src)
}
dst := msg.ProtoReflect().Type().New().Interface()

if err := (prototext.Unmarshal(textFormat, dst)); err != nil {
t.Errorf("failed to unmarshal messsage from text format: %v\ntext format: %s", err, textFormat)
t.Errorf("failed to unmarshal message from text format: %v\ntext format: %s", err, textFormat)
}

// The cmp package does not deal with NaN on its own and will report
Expand Down
2 changes: 1 addition & 1 deletion encoding/protowire/wire_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type (
}
appendRaw []byte

// consumeOp represents an Consume operation.
// consumeOp represents a Consume operation.
consumeOp = any
consumeField struct {
wantNum Number
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/generate-protos/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func generateRemoteProtos() {

// Benchmark protos.
// TODO: The protobuf repo no longer includes benchmarks.
// CL removing them says they are superceded by google/fleetbench:
// CL removing them says they are superseded by google/fleetbench:
// https://github.com/protocolbuffers/protobuf/commit/83c499de86224538e5d59adc3d0fa7fdb45b2c72
// But that project's proto benchmark files are very different:
// https://github.com/google/fleetbench/tree/main/fleetbench/proto
Expand Down
4 changes: 2 additions & 2 deletions internal/conformance/failing_tests_text_format.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Recommended.Editions_Proto3.ProtobufInput.MessageUnknownFields_Print.TextFormatOutput # TEXT_FORMAT output we received from test was unparseable.
Recommended.Editions_Proto3.ProtobufInput.MessageUnknownFields_Print.TextFormatOutput # TEXT_FORMAT output we received from test was unparsable.
Recommended.Editions_Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairBytes # Should have failed to parse, but didn't.
Recommended.Editions_Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairString # Should have failed to parse, but didn't.
Recommended.Editions_Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortBytes # Should have failed to parse, but didn't.
Recommended.Editions_Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortString # Should have failed to parse, but didn't.
Recommended.Proto3.ProtobufInput.MessageUnknownFields_Print.TextFormatOutput # TEXT_FORMAT output we received from test was unparseable.
Recommended.Proto3.ProtobufInput.MessageUnknownFields_Print.TextFormatOutput # TEXT_FORMAT output we received from test was unparsable.
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairBytes # Should have failed to parse, but didn't.
Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairString # Should have failed to parse, but didn't.
Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortBytes # Should have failed to parse, but didn't.
Expand Down
2 changes: 1 addition & 1 deletion internal/encoding/tag/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func Marshal(fd protoreflect.FieldDescriptor, enumName string) string {
}
tag = append(tag, "name="+name)
if jsonName := fd.JSONName(); jsonName != "" && jsonName != name && !fd.IsExtension() {
// NOTE: The jsonName != name condition is suspect, but it preserve
// NOTE: The jsonName != name condition is suspect, but it preserves
// the exact same semantics from the previous generator.
tag = append(tag, "json="+jsonName)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/encoding/text/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func (d *Decoder) parseNext(lastKind Kind) (Token, error) {

case ListOpen:
if lastKind == semicolon {
// It is not be possible to have this case as logic here
// It is not possible to have this case as logic here
// should not have produced a semicolon Token when inside a
// list. Let it panic below.
break
Expand Down
2 changes: 1 addition & 1 deletion internal/encoding/text/decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ func TestDecoder(t *testing.T) {
},
},
{
// Whitespaces/comments are only allowed betweeb
// Whitespaces/comments are only allowed between
in: "[" + space + "domain" + space + "." + space + "com # comment\n" +
"/" + "pkg" + space + "." + space + "type" + space + "]",
want: []R{
Expand Down
4 changes: 2 additions & 2 deletions internal/filedesc/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Package filedesc provides functionality for constructing descriptors.
//
// The types in this package implement interfaces in the protoreflect package
// related to protobuf descripriptors.
// related to protobuf descriptors.
package filedesc

import (
Expand Down Expand Up @@ -40,7 +40,7 @@ type Builder struct {
protoregistry.ExtensionTypeResolver
}

// FileRegistry is use to lookup file, enum, and message dependencies.
// FileRegistry is used to lookup file, enum, and message dependencies.
// Once constructed, the file descriptor is registered here.
// If nil, it uses protoregistry.GlobalFiles.
FileRegistry interface {
Expand Down
6 changes: 3 additions & 3 deletions internal/filedesc/editions.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func unmarshalGoFeature(b []byte, parent EditionFeatures) EditionFeatures {
b = b[m:]
parent.GenerateLegacyUnmarshalJSON = protowire.DecodeBool(v)
default:
panic(fmt.Sprintf("unkown field number %d while unmarshalling GoFeatures", num))
panic(fmt.Sprintf("unknown field number %d while unmarshalling GoFeatures", num))
}
}
return parent
Expand Down Expand Up @@ -62,7 +62,7 @@ func unmarshalFeatureSet(b []byte, parent EditionFeatures) EditionFeatures {
case genid.FeatureSet_JsonFormat_field_number:
parent.IsJSONCompliant = v == genid.FeatureSet_ALLOW_enum_value
default:
panic(fmt.Sprintf("unkown field number %d while unmarshalling FeatureSet", num))
panic(fmt.Sprintf("unknown field number %d while unmarshalling FeatureSet", num))
}
case protowire.BytesType:
v, m := protowire.ConsumeBytes(b)
Expand Down Expand Up @@ -136,7 +136,7 @@ func unmarshalEditionDefaults(b []byte) {
_, m := protowire.ConsumeVarint(b)
b = b[m:]
default:
panic(fmt.Sprintf("unkown field number %d while unmarshalling EditionDefault", num))
panic(fmt.Sprintf("unknown field number %d while unmarshalling EditionDefault", num))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/impl/codec_extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (f *ExtensionField) canLazy(xt protoreflect.ExtensionType) bool {
return false
}

// isUnexpandedLazy returns true if the ExensionField is lazy and not
// isUnexpandedLazy returns true if the ExtensionField is lazy and not
// yet expanded, which means it's present and already checked for
// initialized required fields.
func (f *ExtensionField) isUnexpandedLazy() bool {
Expand Down
12 changes: 6 additions & 6 deletions internal/impl/lazy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func TestExtensionLazy(t *testing.T) {

fox := proto.GetExtension(nt, lazytestpb.E_Bat).(*lazytestpb.FlyingFox)
if got, want := fox.GetSpecies(), spGH; want != got {
t.Errorf("Extension's Speices field not retained, want: %v, got: %v", want, got)
t.Errorf("Extension's Species field not retained, want: %v, got: %v", want, got)
}
if got, want := extensionIsInitialized(t, nt, lazytestpb.E_Bat.Field), true; got != want {
t.Errorf("Extension unexpectedly initialized after Get")
Expand All @@ -164,7 +164,7 @@ func TestExtensionLazy(t *testing.T) {
}
foxPup := proto.GetExtension(nt, lazytestpb.E_BatPup).(*lazytestpb.FlyingFox)
if got, want := foxPup.GetSpecies(), spP; want != got {
t.Errorf("Extension's Speices field not retained, want: %v, got: %v", want, got)
t.Errorf("Extension's Species field not retained, want: %v, got: %v", want, got)
}
if got, want := extensionIsInitialized(t, nt, lazytestpb.E_Bat.Field), true; got != want {
t.Errorf("Extension unexpectedly initialized after Get")
Expand Down Expand Up @@ -226,7 +226,7 @@ func TestExtensionNestedScopeLazy(t *testing.T) {

fox := proto.GetExtension(nt, lazytestpb.E_BatNest_Bat).(*lazytestpb.FlyingFox)
if got, want := fox.GetSpecies(), spGH; want != got {
t.Errorf("Extension's Speices field not retained, want: %v, got: %v", want, got)
t.Errorf("Extension's Species field not retained, want: %v, got: %v", want, got)
}
if got, want := extensionIsInitialized(t, nt, lazytestpb.E_BatNest_Bat.Field), true; got != want {
t.Errorf("Extension unexpectedly initialized after Get")
Expand Down Expand Up @@ -277,7 +277,7 @@ func TestExtensionRepeatedMessageLazy(t *testing.T) {
mrr = roundtrip(t, mr).(*lazytestpb.Tree)
foxPosse := proto.GetExtension(mrr, lazytestpb.E_BatPosse).([]*lazytestpb.FlyingFox)
if got, want := foxPosse[0].GetSpecies(), spLE; got != want {
t.Errorf("Extension's Speices field, want: %v, got: %v", want, got)
t.Errorf("Extension's Species field, want: %v, got: %v", want, got)
}
if got, want := extensionIsInitialized(t, mrr, lazytestpb.E_BatPosse.Field), true; got != want {
t.Errorf("Extension unexpectedly initialized after Get")
Expand Down Expand Up @@ -424,7 +424,7 @@ func TestExtensionGroupLazy(t *testing.T) {
}
pipistrelle := proto.GetExtension(mrr, lazytestpb.E_Pipistrelle).(*lazytestpb.Pipistrelle)
if got, want := pipistrelle.GetSpecies(), spF; got != want {
t.Errorf("Extension's Speices field, want: %v, got: %v", want, got)
t.Errorf("Extension's Species field, want: %v, got: %v", want, got)
}
if got, want := extensionIsInitialized(t, mrr, lazytestpb.E_Pipistrelle.Field), true; got != want {
t.Errorf("Extension unexpectedly initialized after Get")
Expand Down Expand Up @@ -458,7 +458,7 @@ func TestExtensionGroupLazy(t *testing.T) {
mrr = roundtrip(t, mr).(*lazytestpb.Tree)
pipistrelles := proto.GetExtension(mrr, lazytestpb.E_Pipistrelles).([]*lazytestpb.Pipistrelles)
if got, want := pipistrelles[1].GetSpecies(), spR; got != want {
t.Errorf("Extension's Speices field, want: %v, got: %v", want, got)
t.Errorf("Extension's Species field, want: %v, got: %v", want, got)
}
if got, want := extensionIsInitialized(t, mrr, lazytestpb.E_Pipistrelles.Field), true; got != want {
t.Errorf("Extension unexpectedly initialized after Get")
Expand Down
2 changes: 1 addition & 1 deletion internal/order/range.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var messageFieldPool = sync.Pool{
}

type (
// FieldRnger is an interface for visiting all fields in a message.
// FieldRanger is an interface for visiting all fields in a message.
// The protoreflect.Message type implements this interface.
FieldRanger interface{ Range(VisitField) }
// VisitField is called every time a message field is visited.
Expand Down
2 changes: 1 addition & 1 deletion internal/testprotos/legacy/bug1052/bug1052.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// This file exercises a deadlock in registation of legacy extensions:
// This file exercises a deadlock in registration of legacy extensions:
// https://github.com/golang/protobuf/issues/1052
//
// The corresponding .pb.go file was generated with protoc 3.11.3 and
Expand Down
20 changes: 10 additions & 10 deletions internal/testprotos/testeditions/test_extension.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/testprotos/testeditions/test_extension.proto
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,14 @@ message TestFeatureResolution {

extend TestFeatureResolution {
repeated int32 global_expanded_extension = 2;
repeated int32 global_packed_extension_overriden = 3
repeated int32 global_packed_extension_overridden = 3
[features.repeated_field_encoding = PACKED];
}

message RepeatedFieldEncoding {
extend TestFeatureResolution {
repeated int32 message_expanded_extension = 4;
repeated int32 message_packed_extension_overriden = 5
repeated int32 message_packed_extension_overridden = 5
[features.repeated_field_encoding = PACKED];
}
}
Loading