diff --git a/scanner.go b/scanner.go index b203702..043adc3 100644 --- a/scanner.go +++ b/scanner.go @@ -118,7 +118,7 @@ func scanComment(b []byte) ([]byte, []byte) { } } - return b, nil + return b, b[len(b):] } func scanBasicString(b []byte) ([]byte, []byte, error) { diff --git a/unmarshaler_test.go b/unmarshaler_test.go index 43d49a3..30fc53d 100644 --- a/unmarshaler_test.go +++ b/unmarshaler_test.go @@ -1740,6 +1740,12 @@ func TestIssue586(t *testing.T) { require.Error(t, err) } +func TestIssue588(t *testing.T) { + var v interface{} + err := toml.Unmarshal([]byte(`a=[1#`), &v) + require.Error(t, err) +} + //nolint:funlen func TestUnmarshalDecodeErrors(t *testing.T) { examples := []struct {