diff options
| author | Daniel Martí <mvdan@mvdan.cc> | 2017-08-21 22:23:14 +0200 |
|---|---|---|
| committer | Daniel Martí <mvdan@mvdan.cc> | 2017-08-29 20:57:41 +0000 |
| commit | fbc8973a6bc88b50509ea738f475b36ef756bf90 (patch) | |
| tree | bec33b02e805593213b72d9908443131af909fe0 /src/text/template/parse | |
| parent | 305fd9179d2199cd1bb64402405857d2f2d02478 (diff) | |
| download | go-fbc8973a6bc88b50509ea738f475b36ef756bf90.tar.xz | |
all: join some chained ifs to unindent code
Found with mvdan.cc/unindent. It skipped the cases where parentheses
would need to be added, where comments would have to be moved elsewhere,
or where actions and simple logic would mix.
One of them was of the form "err != nil && err == io.EOF", so the first
part was removed.
Change-Id: Ie504c2b03a2c87d10ecbca1b9270069be1171b91
Reviewed-on: https://go-review.googlesource.com/57690
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/text/template/parse')
| -rw-r--r-- | src/text/template/parse/lex.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/text/template/parse/lex.go b/src/text/template/parse/lex.go index 6fbf36d7a4..cdecd412ee 100644 --- a/src/text/template/parse/lex.go +++ b/src/text/template/parse/lex.go @@ -281,10 +281,9 @@ func (l *lexer) atRightDelim() (delim, trimSpaces bool) { return true, false } // The right delim might have the marker before. - if strings.HasPrefix(l.input[l.pos:], rightTrimMarker) { - if strings.HasPrefix(l.input[l.pos+trimMarkerLen:], l.rightDelim) { - return true, true - } + if strings.HasPrefix(l.input[l.pos:], rightTrimMarker) && + strings.HasPrefix(l.input[l.pos+trimMarkerLen:], l.rightDelim) { + return true, true } return false, false } |
