golang.org/x/tools/gopls@v0.15.3/internal/analysis/simplifycompositelit/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 simplifycompositelit defines an Analyzer that simplifies composite literals.
     6  // https://github.com/golang/go/blob/master/src/cmd/gofmt/simplify.go
     7  // https://golang.org/cmd/gofmt/#hdr-The_simplify_command
     8  //
     9  // # Analyzer simplifycompositelit
    10  //
    11  // simplifycompositelit: check for composite literal simplifications
    12  //
    13  // An array, slice, or map composite literal of the form:
    14  //
    15  //	[]T{T{}, T{}}
    16  //
    17  // will be simplified to:
    18  //
    19  //	[]T{{}, {}}
    20  //
    21  // This is one of the simplifications that "gofmt -s" applies.
    22  package simplifycompositelit