Home | History | Annotate | Download | only in testdata
      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 // This file contains tests for the unusedresult checker.
      6 
      7 package testdata
      8 
      9 import (
     10 	"bytes"
     11 	"errors"
     12 	"fmt"
     13 )
     14 
     15 func _() {
     16 	fmt.Errorf("") // ERROR "result of fmt.Errorf call not used"
     17 	_ = fmt.Errorf("")
     18 
     19 	errors.New("") // ERROR "result of errors.New call not used"
     20 
     21 	err := errors.New("")
     22 	err.Error() // ERROR "result of \(error\).Error call not used"
     23 
     24 	var buf bytes.Buffer
     25 	buf.String() // ERROR "result of \(bytes.Buffer\).String call not used"
     26 
     27 	fmt.Sprint("")  // ERROR "result of fmt.Sprint call not used"
     28 	fmt.Sprintf("") // ERROR "result of fmt.Sprintf call not used"
     29 }
     30