From 87b9f055f40aa7c800dacacf3a12e153a5e69c4b Mon Sep 17 00:00:00 2001 From: Martin Tournoij Date: Fri, 11 Feb 2022 13:51:05 +0100 Subject: [PATCH] Fix tests for older Go versions --- error.go | 2 +- error_test.go | 2 +- internal/toml-test/json.go | 3 +++ internal/toml-test/runner.go | 3 +++ internal/toml-test/toml.go | 3 +++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/error.go b/error.go index 36edc465..d5728a41 100644 --- a/error.go +++ b/error.go @@ -10,7 +10,7 @@ import ( // For example invalid syntax, duplicate keys, etc. // // In addition to the error message itself, you can also print detailed location -// information with context by using ErrorWithLocation(): +// information with context by using ErrorWithPosition(): // // toml: error: Key 'fruit' was already created and cannot be used as an array. // diff --git a/error_test.go b/error_test.go index 75401583..be6ec7ee 100644 --- a/error_test.go +++ b/error_test.go @@ -121,7 +121,7 @@ func TestParseError(t *testing.T) { fmt.Println("\x1b[1m━━━", path, strings.Repeat("━", 65-len(path)), "\x1b[0m") fmt.Print(pErr.Error()) fmt.Println() - fmt.Println("─── ErrorWithLocation()", strings.Repeat("–", 47)) + fmt.Println("─── ErrorWithPosition()", strings.Repeat("–", 47)) fmt.Print(pErr.ErrorWithPosition()) fmt.Println("─── ErrorWithUsage()", strings.Repeat("–", 50)) fmt.Print(pErr.ErrorWithUsage()) diff --git a/internal/toml-test/json.go b/internal/toml-test/json.go index a5fa2830..4394f419 100644 --- a/internal/toml-test/json.go +++ b/internal/toml-test/json.go @@ -1,3 +1,6 @@ +//go:build go1.16 +// +build go1.16 + package tomltest import ( diff --git a/internal/toml-test/runner.go b/internal/toml-test/runner.go index c838baf0..2bdb1c03 100644 --- a/internal/toml-test/runner.go +++ b/internal/toml-test/runner.go @@ -1,5 +1,8 @@ //go:generate ./gen-multi.py +//go:build go1.16 +// +build go1.16 + package tomltest import ( diff --git a/internal/toml-test/toml.go b/internal/toml-test/toml.go index 346f0a96..934e6314 100644 --- a/internal/toml-test/toml.go +++ b/internal/toml-test/toml.go @@ -1,3 +1,6 @@ +//go:build go1.16 +// +build go1.16 + package tomltest import (