go4.org: go4.org/errorutil Index | Files

package errorutil

import "go4.org/errorutil"

Package errorutil helps make better error messages.


Package Files


func HighlightBytePosition Uses

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.

Package errorutil imports 5 packages (graph) and is imported by 14 packages. Updated 2019-05-07. Refresh now. Tools for package owners.