This commit is contained in:
Thomas Pelletier
2022-08-15 10:56:33 -04:00
committed by GitHub
parent fb6d1d6c2b
commit 67bc5422f3
13 changed files with 73 additions and 48 deletions
+1 -1
View File
@@ -15,6 +15,6 @@ jobs:
- name: Setup go
uses: actions/setup-go@master
with:
go-version: 1.18
go-version: 1.19
- name: Run tests with coverage
run: ./ci.sh coverage -d "${GITHUB_BASE_REF-HEAD}"
+1 -1
View File
@@ -22,7 +22,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
+1 -1
View File
@@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest']
go: [ '1.17', '1.18' ]
go: [ '1.18', '1.19' ]
runs-on: ${{ matrix.os }}
name: ${{ matrix.go }}/${{ matrix.os }}
steps:
+2 -2
View File
@@ -1,6 +1,6 @@
// Package jsontoml is a program that converts JSON to TOML.
//
// Usage
// # Usage
//
// Reading from stdin:
//
@@ -10,7 +10,7 @@
//
// jsontoml file.json > file.toml
//
// Installation
// # Installation
//
// Using Go:
//
+2 -2
View File
@@ -1,6 +1,6 @@
// Package tomljson is a program that converts TOML to JSON.
//
// Usage
// # Usage
//
// Reading from stdin:
//
@@ -10,7 +10,7 @@
//
// tomljson file.toml > file.json
//
// Installation
// # Installation
//
// Using Go:
//
+2 -2
View File
@@ -1,6 +1,6 @@
// Package tomll is a linter program for TOML.
//
// Usage
// # Usage
//
// Reading from stdin, writing to stdout:
//
@@ -10,7 +10,7 @@
//
// tomll a.toml b.toml c.toml
//
// Installation
// # Installation
//
// Using Go:
//
+1
View File
@@ -103,6 +103,7 @@ func (e *DecodeError) Key() Key {
//
// The function copies all bytes used in DecodeError, so that document and
// highlight can be freely deallocated.
//
//nolint:funlen
func wrapDecodeError(document []byte, de *decodeError) *DecodeError {
offset := danger.SubsliceOffset(document, de.highlight)
+1 -2
View File
@@ -1,5 +1,4 @@
//go:build go1.18
// +build go1.18
//go:build go1.18 || go1.19
package toml_test
@@ -151,6 +151,7 @@ type quotedKeyMarshalTestStruct struct {
}
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused,varcheck
var quotedKeyMarshalTestData = quotedKeyMarshalTestStruct{
String: "Hello",
@@ -160,6 +161,7 @@ var quotedKeyMarshalTestData = quotedKeyMarshalTestStruct{
}
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused,varcheck
var quotedKeyMarshalTestToml = []byte(`"Yfloat-𝟘" = 3.5
"Z.string-àéù" = "Hello"
@@ -272,6 +274,7 @@ var docData = testDoc{
}
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused,varcheck
var mapTestDoc = testMapDoc{
Title: "TOML Marshal Testing",
@@ -559,10 +562,12 @@ func (c customMarshaler) MarshalTOML() ([]byte, error) {
var customMarshalerData = customMarshaler{FirstName: "Sally", LastName: "Fields"}
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused,varcheck
var customMarshalerToml = []byte(`Sally Fields`)
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused,varcheck
var nestedCustomMarshalerData = customMarshalerParent{
Self: customMarshaler{FirstName: "Maiku", LastName: "Suteda"},
@@ -570,6 +575,7 @@ var nestedCustomMarshalerData = customMarshalerParent{
}
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused,varcheck
var nestedCustomMarshalerToml = []byte(`friends = ["Sally Fields"]
me = "Maiku Suteda"
@@ -611,6 +617,7 @@ func TestUnmarshalTextMarshaler(t *testing.T) {
}
// TODO: Remove nolint once type and methods are used by a test
//
//nolint:unused
type precedentMarshaler struct {
FirstName string
@@ -629,6 +636,7 @@ func (m precedentMarshaler) MarshalTOML() ([]byte, error) {
}
// TODO: Remove nolint once type and method are used by a test
//
//nolint:unused
type customPointerMarshaler struct {
FirstName string
@@ -641,6 +649,7 @@ func (m *customPointerMarshaler) MarshalTOML() ([]byte, error) {
}
// TODO: Remove nolint once type and method are used by a test
//
//nolint:unused
type textPointerMarshaler struct {
FirstName string
@@ -653,6 +662,7 @@ func (m *textPointerMarshaler) MarshalText() ([]byte, error) {
}
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused,varcheck
var commentTestToml = []byte(`
# it's a comment on type
@@ -690,6 +700,7 @@ type mapsTestStruct struct {
}
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused,varcheck
var mapsTestData = mapsTestStruct{
Simple: map[string]string{
@@ -713,6 +724,7 @@ var mapsTestData = mapsTestStruct{
}
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused,varcheck
var mapsTestToml = []byte(`
[Other]
@@ -735,6 +747,7 @@ var mapsTestToml = []byte(`
`)
// TODO: Remove nolint once type is used by a test
//
//nolint:deadcode,unused
type structArrayNoTag struct {
A struct {
@@ -744,6 +757,7 @@ type structArrayNoTag struct {
}
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused,varcheck
var customTagTestToml = []byte(`
[postgres]
@@ -758,6 +772,7 @@ var customTagTestToml = []byte(`
`)
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused,varcheck
var customCommentTagTestToml = []byte(`
# db connection
@@ -771,6 +786,7 @@ var customCommentTagTestToml = []byte(`
`)
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused,varcheck
var customCommentedTagTestToml = []byte(`
[postgres]
@@ -825,6 +841,7 @@ func TestUnmarshalTabInStringAndQuotedKey(t *testing.T) {
}
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused,varcheck
var customMultilineTagTestToml = []byte(`int_slice = [
1,
@@ -834,6 +851,7 @@ var customMultilineTagTestToml = []byte(`int_slice = [
`)
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused,varcheck
var testDocBasicToml = []byte(`
[document]
@@ -846,12 +864,14 @@ var testDocBasicToml = []byte(`
`)
// TODO: Remove nolint once type is used by a test
//
//nolint:deadcode
type testDocCustomTag struct {
Doc testDocBasicsCustomTag `file:"document"`
}
// TODO: Remove nolint once type is used by a test
//
//nolint:deadcode
type testDocBasicsCustomTag struct {
Bool bool `file:"bool_val"`
@@ -864,6 +884,7 @@ type testDocBasicsCustomTag struct {
}
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,varcheck
var testDocCustomTagData = testDocCustomTag{
Doc: testDocBasicsCustomTag{
@@ -966,6 +987,7 @@ func TestUnmarshalInvalidPointerKind(t *testing.T) {
}
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused
type testDuration struct {
Nanosec time.Duration `toml:"nanosec"`
@@ -980,6 +1002,7 @@ type testDuration struct {
}
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused,varcheck
var testDurationToml = []byte(`
nanosec = "1ns"
@@ -994,6 +1017,7 @@ a_string = "15s"
`)
// TODO: Remove nolint once var is used by a test
//
//nolint:deadcode,unused,varcheck
var testDurationToml2 = []byte(`a_string = "15s"
hour = "1h0m0s"
@@ -1007,6 +1031,7 @@ sec = "1s"
`)
// TODO: Remove nolint once type is used by a test
//
//nolint:deadcode,unused
type testBadDuration struct {
Val time.Duration `toml:"val"`
+2 -2
View File
@@ -89,7 +89,7 @@ func (enc *Encoder) SetIndentTables(indent bool) *Encoder {
//
// If v cannot be represented to TOML it returns an error.
//
// Encoding rules
// # Encoding rules
//
// A top level slice containing only maps or structs is encoded as [[table
// array]].
@@ -130,7 +130,7 @@ func (enc *Encoder) SetIndentTables(indent bool) *Encoder {
// [[array]]
// [array.child2]
//
// Struct tags
// # Struct tags
//
// The encoding of each public struct field can be customized by the format
// string in the "toml" key of the struct field's tag. This follows
+1 -1
View File
@@ -79,7 +79,7 @@ func (d *Decoder) DisallowUnknownFields() *Decoder {
// strict mode and a field is missing, a `toml.StrictMissingError` is
// returned. In any other case, this function returns a standard Go error.
//
// Type mapping
// # Type mapping
//
// List of supported TOML types and their associated accepted Go types:
//