github.com/powerman/golang-tools@v0.1.11-0.20220410185822-5ad214d8d803/go/analysis/passes/unusedresult/testdata/src/a/a.go (about)

     1  // Copyright 2015 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 a
     6  
     7  import (
     8  	"bytes"
     9  	"errors"
    10  	"fmt"
    11  )
    12  
    13  func _() {
    14  	fmt.Errorf("") // want "result of fmt.Errorf call not used"
    15  	_ = fmt.Errorf("")
    16  
    17  	errors.New("") // want "result of errors.New call not used"
    18  
    19  	err := errors.New("")
    20  	err.Error() // want `result of \(error\).Error call not used`
    21  
    22  	var buf bytes.Buffer
    23  	buf.String() // want `result of \(bytes.Buffer\).String call not used`
    24  
    25  	fmt.Sprint("")  // want "result of fmt.Sprint call not used"
    26  	fmt.Sprintf("") // want "result of fmt.Sprintf call not used"
    27  }