golang.org/x/tools@v0.21.0/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  	. "fmt"
    12  )
    13  
    14  func _() {
    15  	fmt.Errorf("") // want "result of fmt.Errorf call not used"
    16  	_ = fmt.Errorf("")
    17  
    18  	errors.New("") // want "result of errors.New call not used"
    19  
    20  	err := errors.New("")
    21  	err.Error() // want `result of \(error\).Error call not used`
    22  
    23  	var buf bytes.Buffer
    24  	buf.String() // want `result of \(\*bytes.Buffer\).String call not used`
    25  
    26  	fmt.Sprint("")  // want "result of fmt.Sprint call not used"
    27  	fmt.Sprintf("") // want "result of fmt.Sprintf call not used"
    28  
    29  	Sprint("")  // want "result of fmt.Sprint call not used"
    30  	Sprintf("") // want "result of fmt.Sprintf call not used"
    31  }