diff --git a/localtime.go b/localtime.go index 6555a10..f271bef 100644 --- a/localtime.go +++ b/localtime.go @@ -23,6 +23,7 @@ // // Because they lack location information, these types do not represent unique // moments or intervals of time. Use time.Time for that purpose. + package toml import ( diff --git a/parser_test.go b/parser_test.go index bdae78a..e4b82a3 100644 --- a/parser_test.go +++ b/parser_test.go @@ -155,12 +155,14 @@ func TestParser_AST_Numbers(t *testing.T) { } } -type astRoot []astNode -type astNode struct { - Kind ast.Kind - Data []byte - Children []astNode -} +type ( + astRoot []astNode + astNode struct { + Kind ast.Kind + Data []byte + Children []astNode + } +) func compareAST(t *testing.T, expected astRoot, actual *ast.Root) { it := actual.Iterator() @@ -168,6 +170,7 @@ func compareAST(t *testing.T, expected astRoot, actual *ast.Root) { } func compareNode(t *testing.T, e astNode, n ast.Node) { + t.Helper() require.Equal(t, e.Kind, n.Kind) require.Equal(t, e.Data, n.Data) @@ -175,6 +178,7 @@ func compareNode(t *testing.T, e astNode, n ast.Node) { } func compareIterator(t *testing.T, expected []astNode, actual ast.Iterator) { + t.Helper() idx := 0 for actual.Next() { diff --git a/toml.abnf b/toml.abnf index 5655ed5..473f374 100644 --- a/toml.abnf +++ b/toml.abnf @@ -59,6 +59,7 @@ val = string / boolean / array / inline-table / date-time / float / integer ;; String string = ml-basic-string / basic-string / ml-literal-string / literal-string + ;; Basic String basic-string = quotation-mark *basic-char quotation-mark diff --git a/unmarshaler_test.go b/unmarshaler_test.go index 8d742f0..4cda0de 100644 --- a/unmarshaler_test.go +++ b/unmarshaler_test.go @@ -132,6 +132,7 @@ func TestUnmarshal_Floats(t *testing.T) { desc: "nan", input: `nan`, testFn: func(t *testing.T, v float64) { + t.Helper() assert.True(t, math.IsNaN(v)) }, }, @@ -139,6 +140,7 @@ func TestUnmarshal_Floats(t *testing.T) { desc: "nan negative", input: `-nan`, testFn: func(t *testing.T, v float64) { + t.Helper() assert.True(t, math.IsNaN(v)) }, }, @@ -146,6 +148,7 @@ func TestUnmarshal_Floats(t *testing.T) { desc: "nan positive", input: `+nan`, testFn: func(t *testing.T, v float64) { + t.Helper() assert.True(t, math.IsNaN(v)) }, }, @@ -759,8 +762,10 @@ func TestIssue484(t *testing.T) { }, cfg) } -type Map458 map[string]interface{} -type Slice458 []interface{} +type ( + Map458 map[string]interface{} + Slice458 []interface{} +) func (m Map458) A(s string) Slice458 { return m[s].([]interface{}) @@ -779,7 +784,8 @@ version = "0.1.0"`) map[string]interface{}{ "dependencies": []interface{}{"regex"}, "name": "decode", - "version": "0.1.0"}, + "version": "0.1.0", + }, } assert.Equal(t, expected, a) } @@ -790,7 +796,7 @@ func TestIssue252(t *testing.T) { Val2 string `toml:"val2"` } - var configFile = []byte( + configFile := []byte( ` val1 = "test1" `) @@ -940,7 +946,7 @@ func TestIssue508(t *testing.T) { head } - var b = []byte(`title = "This is a title"`) + b := []byte(`title = "This is a title"`) t1 := text{} err := toml.Unmarshal(b, &t1)