go4.orggo4.org/errorutil Index | Files

package errorutil

import "go4.org/errorutil"

Package errorutil helps make better error messages.

Index

Functions

func HighlightBytePosition

func HighlightBytePosition(f io.Reader, pos int64) (line, col int, highlight string)

HighlightBytePosition takes a reader and the location in bytes of a parse error (for instance, from json.SyntaxError.Offset) and returns the line, column, and pretty-printed context around the error with an arrow indicating the exact position of the syntax error.

Source Files

highlight.go

Version
v0.0.0-20230225012048-214862532bf5 (latest)
Published
Feb 25, 2023
Platform
js/wasm
Imports
5 packages
Last checked
1 month ago

Tools for package owners.