Standard library / io
io.Seeker
Changes stream offset relative to start, current position or end; not every stream supports seeking. Expected stdout: '2 <nil>\n'.
Formal Syntax & Structure
go syntaxgo
type Seeker interface { Seek(offset int64, whence int) (int64, error)}Working Example
Example Snippetgo
package main
import ( "fmt" "io" "strings")
func main() { var s io.Seeker = strings.NewReader("abc") n, e := s.Seek(-1, io.SeekEnd) fmt.Println(n, e)}