package safetoken
import "golang.org/x/tools/internal/lsp/safetoken"
Package safetoken provides wrappers around methods in go/token, that return errors rather than panicking.
Index ¶
- func InRange(tf *token.File, pos token.Pos) bool
- func Offset(tf *token.File, pos token.Pos) (int, error)
- func Pos(tf *token.File, offset int) (token.Pos, error)
Functions ¶
func InRange ¶
InRange reports whether the given position is in the given token.File.
func Offset ¶
Offset returns tok.Offset(pos), but first checks that the pos is in range for the given file.
func Pos ¶
Pos returns tok.Pos(offset), but first checks that the offset is valid for the given file.
Source Files ¶
safetoken.go
- Version
- v0.1.11
- Published
- Jun 9, 2022
- Platform
- darwin/amd64
- Imports
- 2 packages
- Last checked
- 15 seconds ago –
Tools for package owners.