Doc: clarify errors returned by Decode (#713)

Fixes #625
This commit is contained in:
Thomas Pelletier
2021-12-26 20:04:09 +01:00
committed by GitHub
parent 535fc65c5f
commit d58eb50ebf
3 changed files with 14 additions and 8 deletions
+6 -6
View File
@@ -212,12 +212,12 @@ func ExampleDecodeError() {
fmt.Println(err)
//nolint:errorlint
de := err.(*DecodeError)
fmt.Println(de.String())
row, col := de.Position()
fmt.Println("error occurred at row", row, "column", col)
var derr *DecodeError
if errors.As(err, &derr) {
fmt.Println(derr.String())
row, col := derr.Position()
fmt.Println("error occurred at row", row, "column", col)
}
// Output:
// toml: number must have at least one digit between underscores
// 1| name = 123__456