Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(616)

Unified Diff: src/cmd/gofmt/simplify.go

Issue 14229043: code review 14229043: gofmt: explain why lower bounds aren't automatically si... (Closed)
Patch Set: diff -r 664c8763de42 https://code.google.com/p/go Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmd/gofmt/simplify.go
===================================================================
--- a/src/cmd/gofmt/simplify.go
+++ b/src/cmd/gofmt/simplify.go
@@ -90,6 +90,10 @@
// Note: We could also simplify slice expressions of the form s[0:b] to s[:b]
// but we leave them as is since sometimes we want to be very explicit
// about the lower bound.
+ // An example where the 0 helps:
+ // x, y, z := b[0:2], b[2:4], b[4:6]
+ // An example where it does not:
+ // x, y := b[:n], b[n:]
case *ast.RangeStmt:
// a range of the form: for x, _ = range v {...}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b