github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/staticcheck/sa1013/testdata/src/example.com/checkStdlibUsageSeeker/checkStdlibUsageSeeker.go.golden (about)

     1  package pkg
     2  
     3  import (
     4  	"io"
     5  	myio "io"
     6  	"os"
     7  )
     8  
     9  type T struct{}
    10  
    11  func (T) Seek(whence int, offset int64) (int64, error) {
    12  	// This method does NOT implement io.Seeker
    13  	return 0, nil
    14  }
    15  
    16  func fn() {
    17  	const SeekStart = 0
    18  	var s io.Seeker
    19  	s.Seek(0, 0)
    20  	s.Seek(0, io.SeekStart)
    21  	s.Seek(0, io.SeekStart)   //@ diag(`the first argument of io.Seeker is the offset`)
    22  	s.Seek(0, myio.SeekStart) //@ diag(`the first argument of io.Seeker is the offset`)
    23  	s.Seek(SeekStart, 0)
    24  
    25  	var f *os.File
    26  	f.Seek(0, io.SeekStart) //@ diag(`the first argument of io.Seeker is the offset`)
    27  
    28  	var t T
    29  	t.Seek(io.SeekStart, 0) // not flagged, T is not an io.Seeker
    30  }