Skip to content

Commit

Permalink
text/template: remove redundant indirect
Browse files Browse the repository at this point in the history
Change-Id: I8cc9783fd044bed48347824dcf973c61c78275a5
Reviewed-on: https://go-review.googlesource.com/15833
Reviewed-by: Andrew Gerrand <[email protected]>
  • Loading branch information
nodirt authored and adg committed Oct 28, 2015
1 parent bc3f14f commit 4038901
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/text/template/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ func (s *state) evalField(dot reflect.Value, fieldName string, node parse.Node,
return zero
}
typ := receiver.Type()
receiver, _ = indirect(receiver)
receiver, isNil := indirect(receiver)
// Unless it's an interface, need to get to a value of type *T to guarantee
// we see all methods of T and *T.
ptr := receiver
Expand All @@ -535,7 +535,6 @@ func (s *state) evalField(dot reflect.Value, fieldName string, node parse.Node,
}
hasArgs := len(args) > 1 || final.IsValid()
// It's not a method; must be a field of a struct or an element of a map. The receiver must not be nil.
receiver, isNil := indirect(receiver)
if isNil {
s.errorf("nil pointer evaluating %s.%s", typ, fieldName)
}
Expand Down

0 comments on commit 4038901

Please sign in to comment.