Skip to content

Commit

Permalink
make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
jhump committed Mar 27, 2024
1 parent 66f2e21 commit bab801a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions linker/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ func (r *result) validateExtension(fd *fldDescriptor, handler *reporter.Handler)
if err != nil {
return err
}
} else if extDecl.GetFullName() != "."+string(fd.FullName()) {
break
}
if extDecl.GetFullName() != "."+string(fd.FullName()) {
file := r.FileNode()
info := file.NodeInfo(r.FieldNode(fd.proto).FieldName())
span, _ := findExtensionRangeOptionSpan(msg.ParentFile(), msg, i, extRange,
Expand All @@ -167,7 +169,8 @@ func (r *result) validateExtension(fd *fldDescriptor, handler *reporter.Handler)
if err != nil {
return err
}
} else if extDecl.GetType() != getTypeName(fd) {
}
if extDecl.GetType() != getTypeName(fd) {
file := r.FileNode()
info := file.NodeInfo(r.FieldNode(fd.proto).FieldType())
span, _ := findExtensionRangeOptionSpan(msg.ParentFile(), msg, i, extRange,
Expand All @@ -177,7 +180,8 @@ func (r *result) validateExtension(fd *fldDescriptor, handler *reporter.Handler)
if err != nil {
return err
}
} else if extDecl.GetRepeated() != (fd.Cardinality() == protoreflect.Repeated) {
}
if extDecl.GetRepeated() != (fd.Cardinality() == protoreflect.Repeated) {
expected, actual := "repeated", "optional"
if !extDecl.GetRepeated() {
expected, actual = actual, expected
Expand Down Expand Up @@ -650,9 +654,10 @@ func findExtensionRangeOptionSpan(
return ast.UnknownSpan(file.Path()), true
}

//nolint:gocritic // intentionally assigning to different slice variables
extRangePath := append(msgPath, internal.MessageExtensionRangesTag, int32(extRangeIndex))
optsPath := append(extRangePath, internal.ExtensionRangeOptionsTag)
fullPath := append(optsPath, path...)
optsPath := append(extRangePath, internal.ExtensionRangeOptionsTag) //nolint:gocritic
fullPath := append(optsPath, path...) //nolint:gocritic
srcLoc := srcLocs.ByPath(fullPath)
if srcLoc.Path != nil {
// found it
Expand Down Expand Up @@ -795,7 +800,6 @@ func findMatchingValueNode(
// We're done matching!
return val, matchLen
}
currIsRepeated = false
}

msgValue, ok := val.(*ast.MessageLiteralNode)
Expand Down
2 changes: 1 addition & 1 deletion parser/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ func asExtsNode(er *descriptorpb.DescriptorProto_ExtensionRange) proto.Message {

// a simple marker type that allows us to have two distinct keys in a map for
// the same ExtensionRange proto -- one for the range itself and another to
// associate with the enclosing/parent AST node
// associate with the enclosing/parent AST node.
type extsParent struct {
*descriptorpb.DescriptorProto_ExtensionRange
}

0 comments on commit bab801a

Please sign in to comment.