github.com/joshdk/godel@v0.0.0-20170529232908-862138a45aee/apps/okgo/integration_test/testdata/standard/pkg1/bad.go (about)

     1  package pkg1
     2  
     3  import myjson "encoding/json"
     4  
     5  // Errcheck function.
     6  func Errcheck() {
     7  	helper := func() error {
     8  		return nil
     9  	}
    10  	// does not check for returned error
    11  	helper()
    12  }
    13  
    14  // Outparamcheck function.
    15  func Outparamcheck() {
    16  	_ = myjson.Unmarshal(nil, "")
    17  }
    18  
    19  // Vet function.
    20  func Vet() string {
    21  	var foo string
    22  	// self-assignment
    23  	foo = foo
    24  	return foo
    25  }
    26  
    27  func deadcode() {
    28  	// unused unexported function
    29  }
    30  
    31  // Ineffassign function.
    32  func Ineffassign() {
    33  	var kvs [][]string
    34  	kvs = append(kvs, nil)
    35  	// assignment has no result
    36  	kvs = nil
    37  }
    38  
    39  // unexported unused constant
    40  const varcheck = "foo"
    41  
    42  // Unconvert function.
    43  func Unconvert() string {
    44  	foo := "bar"
    45  	foo = string(foo)
    46  	return foo
    47  }
    48  
    49  // This comment will be flagged as bad by Lint.
    50  func Lint() {
    51  }