mirror of https://github.com/perkeep/perkeep.git
errorutil: write docs
Change-Id: I23b60fe920a897427c4d473fd8c7c9ba6ee40d44
This commit is contained in:
parent
6a8a5e197e
commit
8d6c4fdc81
|
@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package errorutil helps make better error messages.
|
||||
package errorutil
|
||||
|
||||
import (
|
||||
|
@ -24,7 +25,11 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
func HighlightBytePosition(f io.Reader, pos int64) (line int, 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.
|
||||
func HighlightBytePosition(f io.Reader, pos int64) (line, col int, highlight string) {
|
||||
line = 1
|
||||
br := bufio.NewReader(f)
|
||||
lastLine := ""
|
||||
|
|
Loading…
Reference in New Issue