github.com/serversong/goreporter@v0.0.0-20200325104552-3cfaf44fd178/linters/staticcheck/testdata/CheckDeprecated.go (about)

     1  package pkg
     2  
     3  import (
     4  	"compress/flate"
     5  	"net/http"
     6  	"os"
     7  	"syscall"
     8  )
     9  
    10  var _ = syscall.StringByteSlice("") // MATCH /Use ByteSliceFromString instead/
    11  
    12  func fn1(err error) {
    13  	var r *http.Request
    14  	_ = r.Cancel                        // MATCH /Use the Context and WithContext methods/
    15  	_ = syscall.StringByteSlice("")     // MATCH /Use ByteSliceFromString instead/
    16  	_ = os.SEEK_SET                     // MATCH /Use io.SeekStart, io.SeekCurrent, and io.SeekEnd/
    17  	if err == http.ErrWriteAfterFlush { // MATCH /ErrWriteAfterFlush is no longer used/
    18  		println()
    19  	}
    20  	var _ flate.ReadError // MATCH /No longer returned/
    21  }
    22  
    23  // Deprecated: Don't use this.
    24  func fn2() {
    25  	_ = syscall.StringByteSlice("")
    26  
    27  	anon := func(x int) {
    28  		println(x)
    29  		_ = syscall.StringByteSlice("")
    30  	}
    31  	anon(1)
    32  }