Skip to content

Commit 67bc542

Browse files
authored
Go 1.19 (#802)
1 parent fb6d1d6 commit 67bc542

File tree

13 files changed

+73
-48
lines changed

13 files changed

+73
-48
lines changed

.github/workflows/coverage.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ jobs:
1515
- name: Setup go
1616
uses: actions/setup-go@master
1717
with:
18-
go-version: 1.18
18+
go-version: 1.19
1919
- name: Run tests with coverage
2020
run: ./ci.sh coverage -d "${GITHUB_BASE_REF-HEAD}"

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Set up Go
2323
uses: actions/setup-go@v2
2424
with:
25-
go-version: 1.18
25+
go-version: 1.19
2626
- name: Login to GitHub Container Registry
2727
uses: docker/login-action@v2
2828
with:

.github/workflows/workflow.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest']
15-
go: [ '1.17', '1.18' ]
15+
go: [ '1.18', '1.19' ]
1616
runs-on: ${{ matrix.os }}
1717
name: ${{ matrix.go }}/${{ matrix.os }}
1818
steps:

cmd/jsontoml/main.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
// Package jsontoml is a program that converts JSON to TOML.
22
//
3-
// Usage
3+
// # Usage
44
//
55
// Reading from stdin:
66
//
7-
// cat file.json | jsontoml > file.toml
7+
// cat file.json | jsontoml > file.toml
88
//
99
// Reading from a file:
1010
//
11-
// jsontoml file.json > file.toml
11+
// jsontoml file.json > file.toml
1212
//
13-
// Installation
13+
// # Installation
1414
//
1515
// Using Go:
1616
//
17-
// go install github.com/pelletier/go-toml/v2/cmd/jsontoml@latest
17+
// go install github.com/pelletier/go-toml/v2/cmd/jsontoml@latest
1818
package main
1919

2020
import (

cmd/tomljson/main.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
// Package tomljson is a program that converts TOML to JSON.
22
//
3-
// Usage
3+
// # Usage
44
//
55
// Reading from stdin:
66
//
7-
// cat file.toml | tomljson > file.json
7+
// cat file.toml | tomljson > file.json
88
//
99
// Reading from a file:
1010
//
11-
// tomljson file.toml > file.json
11+
// tomljson file.toml > file.json
1212
//
13-
// Installation
13+
// # Installation
1414
//
1515
// Using Go:
1616
//
17-
// go install github.com/pelletier/go-toml/v2/cmd/tomljson@latest
17+
// go install github.com/pelletier/go-toml/v2/cmd/tomljson@latest
1818
package main
1919

2020
import (

cmd/tomll/main.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
// Package tomll is a linter program for TOML.
22
//
3-
// Usage
3+
// # Usage
44
//
55
// Reading from stdin, writing to stdout:
66
//
7-
// cat file.toml | tomll
7+
// cat file.toml | tomll
88
//
99
// Reading and updating a list of files in place:
1010
//
11-
// tomll a.toml b.toml c.toml
11+
// tomll a.toml b.toml c.toml
1212
//
13-
// Installation
13+
// # Installation
1414
//
1515
// Using Go:
1616
//
17-
// go install github.com/pelletier/go-toml/v2/cmd/tomll@latest
17+
// go install github.com/pelletier/go-toml/v2/cmd/tomll@latest
1818
package main
1919

2020
import (

cmd/tomltestgen/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//
44
// Within the go-toml package, run `go generate`. Otherwise, use:
55
//
6-
// go run github.com/pelletier/go-toml/cmd/tomltestgen -o toml_testgen_test.go
6+
// go run github.com/pelletier/go-toml/cmd/tomltestgen -o toml_testgen_test.go
77
package main
88

99
import (

errors.go

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ func (e *DecodeError) Key() Key {
103103
//
104104
// The function copies all bytes used in DecodeError, so that document and
105105
// highlight can be freely deallocated.
106+
//
106107
//nolint:funlen
107108
func wrapDecodeError(document []byte, de *decodeError) *DecodeError {
108109
offset := danger.SubsliceOffset(document, de.highlight)

fuzz_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
//go:build go1.18
2-
// +build go1.18
1+
//go:build go1.18 || go1.19
32

43
package toml_test
54

internal/ast/ast.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import (
1111
//
1212
// For example:
1313
//
14-
// it := n.Children()
15-
// for it.Next() {
16-
// it.Node()
17-
// }
14+
// it := n.Children()
15+
// for it.Next() {
16+
// it.Node()
17+
// }
1818
type Iterator struct {
1919
started bool
2020
node *Node

internal/imported_tests/unmarshal_imported_test.go

+25
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ type quotedKeyMarshalTestStruct struct {
151151
}
152152

153153
// TODO: Remove nolint once var is used by a test
154+
//
154155
//nolint:deadcode,unused,varcheck
155156
var quotedKeyMarshalTestData = quotedKeyMarshalTestStruct{
156157
String: "Hello",
@@ -160,6 +161,7 @@ var quotedKeyMarshalTestData = quotedKeyMarshalTestStruct{
160161
}
161162

162163
// TODO: Remove nolint once var is used by a test
164+
//
163165
//nolint:deadcode,unused,varcheck
164166
var quotedKeyMarshalTestToml = []byte(`"Yfloat-𝟘" = 3.5
165167
"Z.string-àéù" = "Hello"
@@ -272,6 +274,7 @@ var docData = testDoc{
272274
}
273275

274276
// TODO: Remove nolint once var is used by a test
277+
//
275278
//nolint:deadcode,unused,varcheck
276279
var mapTestDoc = testMapDoc{
277280
Title: "TOML Marshal Testing",
@@ -559,17 +562,20 @@ func (c customMarshaler) MarshalTOML() ([]byte, error) {
559562
var customMarshalerData = customMarshaler{FirstName: "Sally", LastName: "Fields"}
560563

561564
// TODO: Remove nolint once var is used by a test
565+
//
562566
//nolint:deadcode,unused,varcheck
563567
var customMarshalerToml = []byte(`Sally Fields`)
564568

565569
// TODO: Remove nolint once var is used by a test
570+
//
566571
//nolint:deadcode,unused,varcheck
567572
var nestedCustomMarshalerData = customMarshalerParent{
568573
Self: customMarshaler{FirstName: "Maiku", LastName: "Suteda"},
569574
Friends: []customMarshaler{customMarshalerData},
570575
}
571576

572577
// TODO: Remove nolint once var is used by a test
578+
//
573579
//nolint:deadcode,unused,varcheck
574580
var nestedCustomMarshalerToml = []byte(`friends = ["Sally Fields"]
575581
me = "Maiku Suteda"
@@ -611,6 +617,7 @@ func TestUnmarshalTextMarshaler(t *testing.T) {
611617
}
612618

613619
// TODO: Remove nolint once type and methods are used by a test
620+
//
614621
//nolint:unused
615622
type precedentMarshaler struct {
616623
FirstName string
@@ -629,6 +636,7 @@ func (m precedentMarshaler) MarshalTOML() ([]byte, error) {
629636
}
630637

631638
// TODO: Remove nolint once type and method are used by a test
639+
//
632640
//nolint:unused
633641
type customPointerMarshaler struct {
634642
FirstName string
@@ -641,6 +649,7 @@ func (m *customPointerMarshaler) MarshalTOML() ([]byte, error) {
641649
}
642650

643651
// TODO: Remove nolint once type and method are used by a test
652+
//
644653
//nolint:unused
645654
type textPointerMarshaler struct {
646655
FirstName string
@@ -653,6 +662,7 @@ func (m *textPointerMarshaler) MarshalText() ([]byte, error) {
653662
}
654663

655664
// TODO: Remove nolint once var is used by a test
665+
//
656666
//nolint:deadcode,unused,varcheck
657667
var commentTestToml = []byte(`
658668
# it's a comment on type
@@ -690,6 +700,7 @@ type mapsTestStruct struct {
690700
}
691701

692702
// TODO: Remove nolint once var is used by a test
703+
//
693704
//nolint:deadcode,unused,varcheck
694705
var mapsTestData = mapsTestStruct{
695706
Simple: map[string]string{
@@ -713,6 +724,7 @@ var mapsTestData = mapsTestStruct{
713724
}
714725

715726
// TODO: Remove nolint once var is used by a test
727+
//
716728
//nolint:deadcode,unused,varcheck
717729
var mapsTestToml = []byte(`
718730
[Other]
@@ -735,6 +747,7 @@ var mapsTestToml = []byte(`
735747
`)
736748

737749
// TODO: Remove nolint once type is used by a test
750+
//
738751
//nolint:deadcode,unused
739752
type structArrayNoTag struct {
740753
A struct {
@@ -744,6 +757,7 @@ type structArrayNoTag struct {
744757
}
745758

746759
// TODO: Remove nolint once var is used by a test
760+
//
747761
//nolint:deadcode,unused,varcheck
748762
var customTagTestToml = []byte(`
749763
[postgres]
@@ -758,6 +772,7 @@ var customTagTestToml = []byte(`
758772
`)
759773

760774
// TODO: Remove nolint once var is used by a test
775+
//
761776
//nolint:deadcode,unused,varcheck
762777
var customCommentTagTestToml = []byte(`
763778
# db connection
@@ -771,6 +786,7 @@ var customCommentTagTestToml = []byte(`
771786
`)
772787

773788
// TODO: Remove nolint once var is used by a test
789+
//
774790
//nolint:deadcode,unused,varcheck
775791
var customCommentedTagTestToml = []byte(`
776792
[postgres]
@@ -825,6 +841,7 @@ func TestUnmarshalTabInStringAndQuotedKey(t *testing.T) {
825841
}
826842

827843
// TODO: Remove nolint once var is used by a test
844+
//
828845
//nolint:deadcode,unused,varcheck
829846
var customMultilineTagTestToml = []byte(`int_slice = [
830847
1,
@@ -834,6 +851,7 @@ var customMultilineTagTestToml = []byte(`int_slice = [
834851
`)
835852

836853
// TODO: Remove nolint once var is used by a test
854+
//
837855
//nolint:deadcode,unused,varcheck
838856
var testDocBasicToml = []byte(`
839857
[document]
@@ -846,12 +864,14 @@ var testDocBasicToml = []byte(`
846864
`)
847865

848866
// TODO: Remove nolint once type is used by a test
867+
//
849868
//nolint:deadcode
850869
type testDocCustomTag struct {
851870
Doc testDocBasicsCustomTag `file:"document"`
852871
}
853872

854873
// TODO: Remove nolint once type is used by a test
874+
//
855875
//nolint:deadcode
856876
type testDocBasicsCustomTag struct {
857877
Bool bool `file:"bool_val"`
@@ -864,6 +884,7 @@ type testDocBasicsCustomTag struct {
864884
}
865885

866886
// TODO: Remove nolint once var is used by a test
887+
//
867888
//nolint:deadcode,varcheck
868889
var testDocCustomTagData = testDocCustomTag{
869890
Doc: testDocBasicsCustomTag{
@@ -966,6 +987,7 @@ func TestUnmarshalInvalidPointerKind(t *testing.T) {
966987
}
967988

968989
// TODO: Remove nolint once var is used by a test
990+
//
969991
//nolint:deadcode,unused
970992
type testDuration struct {
971993
Nanosec time.Duration `toml:"nanosec"`
@@ -980,6 +1002,7 @@ type testDuration struct {
9801002
}
9811003

9821004
// TODO: Remove nolint once var is used by a test
1005+
//
9831006
//nolint:deadcode,unused,varcheck
9841007
var testDurationToml = []byte(`
9851008
nanosec = "1ns"
@@ -994,6 +1017,7 @@ a_string = "15s"
9941017
`)
9951018

9961019
// TODO: Remove nolint once var is used by a test
1020+
//
9971021
//nolint:deadcode,unused,varcheck
9981022
var testDurationToml2 = []byte(`a_string = "15s"
9991023
hour = "1h0m0s"
@@ -1007,6 +1031,7 @@ sec = "1s"
10071031
`)
10081032

10091033
// TODO: Remove nolint once type is used by a test
1034+
//
10101035
//nolint:deadcode,unused
10111036
type testBadDuration struct {
10121037
Val time.Duration `toml:"val"`

marshaler.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func NewEncoder(w io.Writer) *Encoder {
5454
// This behavior can be controlled on an individual struct field basis with the
5555
// inline tag:
5656
//
57-
// MyField `toml:",inline"`
57+
// MyField `toml:",inline"`
5858
func (enc *Encoder) SetTablesInline(inline bool) *Encoder {
5959
enc.tablesInline = inline
6060
return enc
@@ -65,7 +65,7 @@ func (enc *Encoder) SetTablesInline(inline bool) *Encoder {
6565
//
6666
// This behavior can be controlled on an individual struct field basis with the multiline tag:
6767
//
68-
// MyField `multiline:"true"`
68+
// MyField `multiline:"true"`
6969
func (enc *Encoder) SetArraysMultiline(multiline bool) *Encoder {
7070
enc.arraysMultiline = multiline
7171
return enc
@@ -89,7 +89,7 @@ func (enc *Encoder) SetIndentTables(indent bool) *Encoder {
8989
//
9090
// If v cannot be represented to TOML it returns an error.
9191
//
92-
// Encoding rules
92+
// # Encoding rules
9393
//
9494
// A top level slice containing only maps or structs is encoded as [[table
9595
// array]].
@@ -120,17 +120,17 @@ func (enc *Encoder) SetIndentTables(indent bool) *Encoder {
120120
// Tables and array tables are separated by empty lines. However, consecutive
121121
// subtables definitions are not. For example:
122122
//
123-
// [top1]
123+
// [top1]
124124
//
125-
// [top2]
126-
// [top2.child1]
125+
// [top2]
126+
// [top2.child1]
127127
//
128-
// [[array]]
128+
// [[array]]
129129
//
130-
// [[array]]
131-
// [array.child2]
130+
// [[array]]
131+
// [array.child2]
132132
//
133-
// Struct tags
133+
// # Struct tags
134134
//
135135
// The encoding of each public struct field can be customized by the format
136136
// string in the "toml" key of the struct field's tag. This follows

0 commit comments

Comments
 (0)