mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
all: gofmt main repo
[This CL is part of a sequence implementing the proposal #51082. The design doc is at https://go.dev/s/godocfmt-design.] Run the updated gofmt, which reformats doc comments, on the main repository. Vendored files are excluded. For #51082. Change-Id: I7332f099b60f716295fb34719c98c04eb1a85407 Reviewed-on: https://go-review.googlesource.com/c/go/+/384268 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
017933163a
commit
19309779ac
373 changed files with 3238 additions and 2532 deletions
|
|
@ -27,17 +27,17 @@ const (
|
|||
//
|
||||
// E.g.
|
||||
//
|
||||
// r := relation(...)
|
||||
// r := relation(...)
|
||||
//
|
||||
// if v < w {
|
||||
// newR := r & lt
|
||||
// }
|
||||
// if v >= w {
|
||||
// newR := r & (eq|gt)
|
||||
// }
|
||||
// if v != w {
|
||||
// newR := r & (lt|gt)
|
||||
// }
|
||||
// if v < w {
|
||||
// newR := r & lt
|
||||
// }
|
||||
// if v >= w {
|
||||
// newR := r & (eq|gt)
|
||||
// }
|
||||
// if v != w {
|
||||
// newR := r & (lt|gt)
|
||||
// }
|
||||
type relation uint
|
||||
|
||||
const (
|
||||
|
|
@ -746,19 +746,19 @@ func (ft *factsTable) cleanup(f *Func) {
|
|||
// By far, the most common redundant pair are generated by bounds checking.
|
||||
// For example for the code:
|
||||
//
|
||||
// a[i] = 4
|
||||
// foo(a[i])
|
||||
// a[i] = 4
|
||||
// foo(a[i])
|
||||
//
|
||||
// The compiler will generate the following code:
|
||||
//
|
||||
// if i >= len(a) {
|
||||
// panic("not in bounds")
|
||||
// }
|
||||
// a[i] = 4
|
||||
// if i >= len(a) {
|
||||
// panic("not in bounds")
|
||||
// }
|
||||
// foo(a[i])
|
||||
// if i >= len(a) {
|
||||
// panic("not in bounds")
|
||||
// }
|
||||
// a[i] = 4
|
||||
// if i >= len(a) {
|
||||
// panic("not in bounds")
|
||||
// }
|
||||
// foo(a[i])
|
||||
//
|
||||
// The second comparison i >= len(a) is clearly redundant because if the
|
||||
// else branch of the first comparison is executed, we already know that i < len(a).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue