golang.org/x/tools/gopls@v0.15.3/internal/analysis/fillreturns/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 fillreturns defines an Analyzer that will attempt to
     6  // automatically fill in a return statement that has missing
     7  // values with zero value elements.
     8  //
     9  // # Analyzer fillreturns
    10  //
    11  // fillreturns: suggest fixes for errors due to an incorrect number of return values
    12  //
    13  // This checker provides suggested fixes for type errors of the
    14  // type "wrong number of return values (want %d, got %d)". For example:
    15  //
    16  //	func m() (int, string, *bool, error) {
    17  //		return
    18  //	}
    19  //
    20  // will turn into
    21  //
    22  //	func m() (int, string, *bool, error) {
    23  //		return 0, "", nil, nil
    24  //	}
    25  //
    26  // This functionality is similar to https://github.com/sqs/goreturns.
    27  package fillreturns