golang.org/x/tools/gopls@v0.15.3/internal/analysis/simplifyrange/doc.go (about)

     1  // Copyright 2023 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package simplifyrange defines an Analyzer that simplifies range statements.
     6  // https://golang.org/cmd/gofmt/#hdr-The_simplify_command
     7  // https://github.com/golang/go/blob/master/src/cmd/gofmt/simplify.go
     8  //
     9  // # Analyzer simplifyrange
    10  //
    11  // simplifyrange: check for range statement simplifications
    12  //
    13  // A range of the form:
    14  //
    15  //	for x, _ = range v {...}
    16  //
    17  // will be simplified to:
    18  //
    19  //	for x = range v {...}
    20  //
    21  // A range of the form:
    22  //
    23  //	for _ = range v {...}
    24  //
    25  // will be simplified to:
    26  //
    27  //	for range v {...}
    28  //
    29  // This is one of the simplifications that "gofmt -s" applies.
    30  package simplifyrange