Go library for the TOML language

Overview

go-toml

Go library for the TOML format.

This library supports TOML version v1.0.0-rc.3

Go Reference license Build Status codecov Go Report Card FOSSA Status

Features

Go-toml provides the following features for using data parsed from TOML documents:

  • Load TOML documents from files and string data
  • Easily navigate TOML structure using Tree
  • Marshaling and unmarshaling to and from data structures
  • Line & column position data for all parsed elements
  • Query support similar to JSON-Path
  • Syntax errors contain line and column numbers

Import

import "github.com/pelletier/go-toml"

Usage example

Read a TOML document:

config, _ := toml.Load(`
[postgres]
user = "pelletier"
password = "mypassword"`)
// retrieve data directly
user := config.Get("postgres.user").(string)

// or using an intermediate object
postgresConfig := config.Get("postgres").(*toml.Tree)
password := postgresConfig.Get("password").(string)

Or use Unmarshal:

type Postgres struct {
    User     string
    Password string
}
type Config struct {
    Postgres Postgres
}

doc := []byte(`
[Postgres]
User = "pelletier"
Password = "mypassword"`)

config := Config{}
toml.Unmarshal(doc, &config)
fmt.Println("user=", config.Postgres.User)

Or use a query:

// use a query to gather elements without walking the tree
q, _ := query.Compile("$..[user,password]")
results := q.Execute(config)
for ii, item := range results.Values() {
    fmt.Printf("Query result %d: %v\n", ii, item)
}

Documentation

The documentation and additional examples are available at pkg.go.dev.

Tools

Go-toml provides three handy command line tools:

  • tomll: Reads TOML files and lints them.

    go install github.com/pelletier/go-toml/cmd/tomll
    tomll --help
    
  • tomljson: Reads a TOML file and outputs its JSON representation.

    go install github.com/pelletier/go-toml/cmd/tomljson
    tomljson --help
    
  • jsontoml: Reads a JSON file and outputs a TOML representation.

    go install github.com/pelletier/go-toml/cmd/jsontoml
    jsontoml --help
    

Docker image

Those tools are also availble as a Docker image from dockerhub. For example, to use tomljson:

docker run -v $PWD:/workdir pelletier/go-toml tomljson /workdir/example.toml

Only master (latest) and tagged versions are published to dockerhub. You can build your own image as usual:

docker build -t go-toml .

Contribute

Feel free to report bugs and patches using GitHub's pull requests system on pelletier/go-toml. Any feedback would be much appreciated!

Run tests

go test ./...

Fuzzing

The script ./fuzz.sh is available to run go-fuzz on go-toml.

Versioning

Go-toml follows Semantic Versioning. The supported version of TOML is indicated at the beginning of this document. The last two major versions of Go are supported (see Go Release Policy).

License

The MIT License (MIT). Read LICENSE.

Issues
  • MapFromTree(t *TomlTree) map[string]interface{} ?

    MapFromTree(t *TomlTree) map[string]interface{} ?

    Would you consider it? Maybe it is there and I'm still missing it. I see TreeFromMap() but actually need the reverse, a clean map. From looking at the code there is enough use of custom structs that stripping them all down to bare Go types might be daunting. I like having the syntax specific errors during the parsing, but then need a very generic map. Writing it now and can submit a PR with the additional function perhaps eventually (since I have to have it either way). Feedback appreciated.

    opened by rwxrob 23
  • Powerful querying interface

    Powerful querying interface

    As pointed out by @eanderton in https://github.com/pelletier/go-toml/pull/21#issuecomment-53159667, it would be great to implement a powerful way to query the tree structure.

    Possible ideas:

    Thoughts, ideas and suggestions are welcome!

    opened by pelletier 20
  • Decode: validate dates

    Decode: validate dates

    Issue: #613

    Constructs a datestring with RFC3339 formatting using the parsed date values, then attempts to call time.Parse() on it, which returns a non-nil error if datetime string was invalid or time's parsing of the string failed.

    Fixes go test -tags testsuite -run TestTOMLTest_Invalid_Datetime_ImpossibleDate failure.

    bug hacktoberfest-accepted 
    opened by jidicula 19
  • Fix tomltestgen failing tests

    Fix tomltestgen failing tests

    After merging https://github.com/pelletier/go-toml/pull/610 the toml-test generated tests have been disabled from automatic build because some tests are failing.

    This issue tracks fixing the failing tests and ultimately make the toml-test generated tests part of the regular build again.

    For new comers, a lot of those issues are corner cases that should be easy to tackle. Feel free to create a pull request for any of them!

    Make sure to remove the Skip() call of the test you're trying to fix in the PR.

    Tests results

    $ echo -e "Status at $(git rev-parse HEAD):\n" && go test -tags testsuite -v -run TestTOML|grep -a -E "(PASS|SKIP):" |sed -E 's/.+(PASS|SKIP): (.+) .+/- [\1] `go test -run \2`/'|sed 's/PASS/x/'|sed 's/SKIP/ /'
    

    Status at 39f893ad996ceacf498c891243955393a8382723:

    • [x] go test -run TestTOMLTest_Invalid_Array_MissingSeparator
    • [x] go test -run TestTOMLTest_Invalid_Array_NoClose2
    • [x] go test -run TestTOMLTest_Invalid_Array_NoCloseTable2
    • [x] go test -run TestTOMLTest_Invalid_Array_NoCloseTable
    • [x] go test -run TestTOMLTest_Invalid_Array_NoClose
    • [x] go test -run TestTOMLTest_Invalid_Array_Tables1
    • [x] go test -run TestTOMLTest_Invalid_Array_Tables2
    • [x] go test -run TestTOMLTest_Invalid_Array_TextAfterArrayEntries
    • [x] go test -run TestTOMLTest_Invalid_Array_TextBeforeArraySeparator
    • [x] go test -run TestTOMLTest_Invalid_Array_TextInArray
    • [x] go test -run TestTOMLTest_Invalid_Bool_MixedCase
    • [x] go test -run TestTOMLTest_Invalid_Bool_WrongCaseFalse
    • [x] go test -run TestTOMLTest_Invalid_Bool_WrongCaseTrue
    • [x] go test -run TestTOMLTest_Invalid_Control_CommentDel
    • [x] go test -run TestTOMLTest_Invalid_Control_CommentLf
    • [x] go test -run TestTOMLTest_Invalid_Control_CommentNull
    • [x] go test -run TestTOMLTest_Invalid_Control_CommentUs
    • [x] go test -run TestTOMLTest_Invalid_Control_MultiDel
    • [x] go test -run TestTOMLTest_Invalid_Control_MultiLf
    • [x] go test -run TestTOMLTest_Invalid_Control_MultiNull
    • [x] go test -run TestTOMLTest_Invalid_Control_MultiUs
    • [x] go test -run TestTOMLTest_Invalid_Control_RawmultiDel
    • [x] go test -run TestTOMLTest_Invalid_Control_RawmultiLf
    • [x] go test -run TestTOMLTest_Invalid_Control_RawmultiNull
    • [x] go test -run TestTOMLTest_Invalid_Control_RawmultiUs
    • [x] go test -run TestTOMLTest_Invalid_Control_RawstringDel
    • [x] go test -run TestTOMLTest_Invalid_Control_RawstringLf
    • [x] go test -run TestTOMLTest_Invalid_Control_RawstringNull
    • [x] go test -run TestTOMLTest_Invalid_Control_RawstringUs
    • [x] go test -run TestTOMLTest_Invalid_Control_StringBs
    • [x] go test -run TestTOMLTest_Invalid_Control_StringDel
    • [x] go test -run TestTOMLTest_Invalid_Control_StringLf
    • [x] go test -run TestTOMLTest_Invalid_Control_StringNull
    • [x] go test -run TestTOMLTest_Invalid_Control_StringUs
    • [x] go test -run TestTOMLTest_Invalid_Datetime_ImpossibleDate
    • [x] go test -run TestTOMLTest_Invalid_Datetime_NoLeadsWithMilli
    • [x] go test -run TestTOMLTest_Invalid_Datetime_NoLeads
    • [x] go test -run TestTOMLTest_Invalid_Datetime_NoSecs
    • [x] go test -run TestTOMLTest_Invalid_Datetime_NoT
    • [x] go test -run TestTOMLTest_Invalid_Datetime_TrailingT
    • [x] go test -run TestTOMLTest_Invalid_Encoding_BadUtf8AtEnd
    • [x] go test -run TestTOMLTest_Invalid_Encoding_BadUtf8InComment
    • [x] go test -run TestTOMLTest_Invalid_Encoding_BadUtf8InString
    • [x] go test -run TestTOMLTest_Invalid_Encoding_BomNotAtStart1
    • [x] go test -run TestTOMLTest_Invalid_Encoding_BomNotAtStart2
    • [x] go test -run TestTOMLTest_Invalid_Encoding_Utf16Bom
    • [x] go test -run TestTOMLTest_Invalid_Encoding_Utf16
    • [x] go test -run TestTOMLTest_Invalid_Float_DoublePoint1
    • [x] go test -run TestTOMLTest_Invalid_Float_DoublePoint2
    • [x] go test -run TestTOMLTest_Invalid_Float_ExpDoubleE1
    • [x] go test -run TestTOMLTest_Invalid_Float_ExpDoubleE2
    • [x] go test -run TestTOMLTest_Invalid_Float_ExpDoubleUs
    • [x] go test -run TestTOMLTest_Invalid_Float_ExpLeadingUs
    • [x] go test -run TestTOMLTest_Invalid_Float_ExpPoint1
    • [x] go test -run TestTOMLTest_Invalid_Float_ExpPoint2
    • [x] go test -run TestTOMLTest_Invalid_Float_ExpTrailingUs
    • [x] go test -run TestTOMLTest_Invalid_Float_InfIncomplete1
    • [x] go test -run TestTOMLTest_Invalid_Float_InfIncomplete2
    • [x] go test -run TestTOMLTest_Invalid_Float_InfIncomplete3
    • [x] go test -run TestTOMLTest_Invalid_Float_Inf_underscore
    • [x] go test -run TestTOMLTest_Invalid_Float_LeadingPointNeg
    • [x] go test -run TestTOMLTest_Invalid_Float_LeadingPointPlus
    • [x] go test -run TestTOMLTest_Invalid_Float_LeadingPoint
    • [x] go test -run TestTOMLTest_Invalid_Float_LeadingUs
    • [x] go test -run TestTOMLTest_Invalid_Float_LeadingZeroNeg
    • [x] go test -run TestTOMLTest_Invalid_Float_LeadingZeroPlus
    • [x] go test -run TestTOMLTest_Invalid_Float_LeadingZero
    • [x] go test -run TestTOMLTest_Invalid_Float_NanIncomplete1
    • [x] go test -run TestTOMLTest_Invalid_Float_NanIncomplete2
    • [x] go test -run TestTOMLTest_Invalid_Float_NanIncomplete3
    • [x] go test -run TestTOMLTest_Invalid_Float_Nan_underscore
    • [x] go test -run TestTOMLTest_Invalid_Float_TrailingPointMin
    • [x] go test -run TestTOMLTest_Invalid_Float_TrailingPointPlus
    • [x] go test -run TestTOMLTest_Invalid_Float_TrailingPoint
    • [x] go test -run TestTOMLTest_Invalid_Float_TrailingUs
    • [x] go test -run TestTOMLTest_Invalid_Float_UsAfterPoint
    • [x] go test -run TestTOMLTest_Invalid_Float_UsBeforePoint
    • [x] go test -run TestTOMLTest_Invalid_InlineTable_DoubleComma
    • [x] go test -run TestTOMLTest_Invalid_InlineTable_Empty
    • [x] go test -run TestTOMLTest_Invalid_InlineTable_Linebreak1
    • [x] go test -run TestTOMLTest_Invalid_InlineTable_Linebreak2
    • [x] go test -run TestTOMLTest_Invalid_InlineTable_Linebreak3
    • [x] go test -run TestTOMLTest_Invalid_InlineTable_Linebreak4
    • [x] go test -run TestTOMLTest_Invalid_InlineTable_NoComma
    • [x] go test -run TestTOMLTest_Invalid_InlineTable_TrailingComma
    • [x] go test -run TestTOMLTest_Invalid_Integer_CapitalBin
    • [x] go test -run TestTOMLTest_Invalid_Integer_CapitalHex
    • [x] go test -run TestTOMLTest_Invalid_Integer_CapitalOct
    • [x] go test -run TestTOMLTest_Invalid_Integer_DoubleSignNex
    • [x] go test -run TestTOMLTest_Invalid_Integer_DoubleSignPlus
    • [x] go test -run TestTOMLTest_Invalid_Integer_DoubleUs
    • [x] go test -run TestTOMLTest_Invalid_Integer_InvalidBin
    • [x] go test -run TestTOMLTest_Invalid_Integer_InvalidHex
    • [x] go test -run TestTOMLTest_Invalid_Integer_InvalidOct
    • [x] go test -run TestTOMLTest_Invalid_Integer_LeadingUsBin
    • [x] go test -run TestTOMLTest_Invalid_Integer_LeadingUsHex
    • [x] go test -run TestTOMLTest_Invalid_Integer_LeadingUsOct
    • [x] go test -run TestTOMLTest_Invalid_Integer_LeadingUs
    • [x] go test -run TestTOMLTest_Invalid_Integer_LeadingZero1
    • [x] go test -run TestTOMLTest_Invalid_Integer_LeadingZero2
    • [x] go test -run TestTOMLTest_Invalid_Integer_LeadingZeroSign1
    • [x] go test -run TestTOMLTest_Invalid_Integer_LeadingZeroSign2
    • [x] go test -run TestTOMLTest_Invalid_Integer_NegativeBin
    • [x] go test -run TestTOMLTest_Invalid_Integer_NegativeHex
    • [x] go test -run TestTOMLTest_Invalid_Integer_NegativeOct
    • [x] go test -run TestTOMLTest_Invalid_Integer_PositiveBin
    • [x] go test -run TestTOMLTest_Invalid_Integer_PositiveHex
    • [x] go test -run TestTOMLTest_Invalid_Integer_PositiveOct
    • [x] go test -run TestTOMLTest_Invalid_Integer_TextAfterInteger
    • [x] go test -run TestTOMLTest_Invalid_Integer_TrailingUsBin
    • [x] go test -run TestTOMLTest_Invalid_Integer_TrailingUsHex
    • [x] go test -run TestTOMLTest_Invalid_Integer_TrailingUsOct
    • [x] go test -run TestTOMLTest_Invalid_Integer_TrailingUs
    • [x] go test -run TestTOMLTest_Invalid_Integer_UsAfterBin
    • [x] go test -run TestTOMLTest_Invalid_Integer_UsAfterHex
    • [x] go test -run TestTOMLTest_Invalid_Integer_UsAfterOct
    • [x] go test -run TestTOMLTest_Invalid_Key_AfterArray
    • [x] go test -run TestTOMLTest_Invalid_Key_AfterTable
    • [x] go test -run TestTOMLTest_Invalid_Key_AfterValue
    • [x] go test -run TestTOMLTest_Invalid_Key_BareInvalidCharacter
    • [x] go test -run TestTOMLTest_Invalid_Key_DottedRedefineTable
    • [x] go test -run TestTOMLTest_Invalid_Key_DuplicateKeys
    • [x] go test -run TestTOMLTest_Invalid_Key_Duplicate
    • [x] go test -run TestTOMLTest_Invalid_Key_Empty
    • [x] go test -run TestTOMLTest_Invalid_Key_Escape
    • [x] go test -run TestTOMLTest_Invalid_Key_Hash
    • [x] go test -run TestTOMLTest_Invalid_Key_Multiline
    • [x] go test -run TestTOMLTest_Invalid_Key_Newline
    • [x] go test -run TestTOMLTest_Invalid_Key_NoEol
    • [x] go test -run TestTOMLTest_Invalid_Key_OpenBracket
    • [x] go test -run TestTOMLTest_Invalid_Key_PartialQuoted
    • [x] go test -run TestTOMLTest_Invalid_Key_SingleOpenBracket
    • [x] go test -run TestTOMLTest_Invalid_Key_Space
    • [x] go test -run TestTOMLTest_Invalid_Key_SpecialCharacter
    • [x] go test -run TestTOMLTest_Invalid_Key_StartBracket
    • [x] go test -run TestTOMLTest_Invalid_Key_TwoEquals
    • [x] go test -run TestTOMLTest_Invalid_Key_TwoEquals2
    • [x] go test -run TestTOMLTest_Invalid_Key_TwoEquals3
    • [x] go test -run TestTOMLTest_Invalid_Key_WithoutValue1
    • [x] go test -run TestTOMLTest_Invalid_Key_WithoutValue2
    • [x] go test -run TestTOMLTest_Invalid_String_BadByteEscape
    • [x] go test -run TestTOMLTest_Invalid_String_BadCodepoint
    • [x] go test -run TestTOMLTest_Invalid_String_BadConcat
    • [x] go test -run TestTOMLTest_Invalid_String_BadEscape
    • [x] go test -run TestTOMLTest_Invalid_String_BadMultiline
    • [x] go test -run TestTOMLTest_Invalid_String_BadSlashEscape
    • [x] go test -run TestTOMLTest_Invalid_String_BadUniEsc
    • [x] go test -run TestTOMLTest_Invalid_String_BasicByteEscapes
    • [x] go test -run TestTOMLTest_Invalid_String_BasicMultilineOutOfRangeUnicodeEscape1
    • [x] go test -run TestTOMLTest_Invalid_String_BasicMultilineOutOfRangeUnicodeEscape2
    • [x] go test -run TestTOMLTest_Invalid_String_BasicMultilineQuotes
    • [x] go test -run TestTOMLTest_Invalid_String_BasicMultilineUnknownEscape
    • [x] go test -run TestTOMLTest_Invalid_String_BasicOutOfRangeUnicodeEscape1
    • [x] go test -run TestTOMLTest_Invalid_String_BasicOutOfRangeUnicodeEscape2
    • [x] go test -run TestTOMLTest_Invalid_String_BasicUnknownEscape
    • [x] go test -run TestTOMLTest_Invalid_String_LiteralMultilineQuotes1
    • [x] go test -run TestTOMLTest_Invalid_String_LiteralMultilineQuotes2
    • [x] go test -run TestTOMLTest_Invalid_String_MissingQuotes
    • [x] go test -run TestTOMLTest_Invalid_String_MultilineEscapeSpace
    • [x] go test -run TestTOMLTest_Invalid_String_MultilineNoClose2
    • [x] go test -run TestTOMLTest_Invalid_String_MultilineNoClose
    • [x] go test -run TestTOMLTest_Invalid_String_MultilineQuotes1
    • [x] go test -run TestTOMLTest_Invalid_String_MultilineQuotes2
    • [x] go test -run TestTOMLTest_Invalid_String_NoClose
    • [x] go test -run TestTOMLTest_Invalid_String_TextAfterString
    • [x] go test -run TestTOMLTest_Invalid_String_WrongClose
    • [x] go test -run TestTOMLTest_Invalid_Table_ArrayEmpty
    • [x] go test -run TestTOMLTest_Invalid_Table_ArrayImplicit
    • [x] go test -run TestTOMLTest_Invalid_Table_ArrayMissingBracket
    • [x] go test -run TestTOMLTest_Invalid_Table_DuplicateKeyTable
    • [x] go test -run TestTOMLTest_Invalid_Table_DuplicateTableArray
    • [x] go test -run TestTOMLTest_Invalid_Table_DuplicateTableArray2
    • [x] go test -run TestTOMLTest_Invalid_Table_Duplicate
    • [x] go test -run TestTOMLTest_Invalid_Table_EmptyImplicitTable
    • [x] go test -run TestTOMLTest_Invalid_Table_Empty
    • [x] go test -run TestTOMLTest_Invalid_Table_EqualsSign
    • [x] go test -run TestTOMLTest_Invalid_Table_Injection1
    • [x] go test -run TestTOMLTest_Invalid_Table_Injection2
    • [x] go test -run TestTOMLTest_Invalid_Table_Llbrace
    • [x] go test -run TestTOMLTest_Invalid_Table_NestedBracketsClose
    • [x] go test -run TestTOMLTest_Invalid_Table_NestedBracketsOpen
    • [x] go test -run TestTOMLTest_Invalid_Table_QuotedNoClose
    • [x] go test -run TestTOMLTest_Invalid_Table_Redefine
    • [x] go test -run TestTOMLTest_Invalid_Table_Rrbrace
    • [x] go test -run TestTOMLTest_Invalid_Table_TextAfterTable
    • [x] go test -run TestTOMLTest_Invalid_Table_Whitespace
    • [x] go test -run TestTOMLTest_Invalid_Table_WithPound
    • [x] go test -run TestTOMLTest_Valid_Array_Array
    • [x] go test -run TestTOMLTest_Valid_Array_Bool
    • [x] go test -run TestTOMLTest_Valid_Array_Empty
    • [x] go test -run TestTOMLTest_Valid_Array_Hetergeneous
    • [x] go test -run TestTOMLTest_Valid_Array_MixedIntArray
    • [x] go test -run TestTOMLTest_Valid_Array_MixedIntFloat
    • [x] go test -run TestTOMLTest_Valid_Array_MixedIntString
    • [x] go test -run TestTOMLTest_Valid_Array_MixedStringTable
    • [x] go test -run TestTOMLTest_Valid_Array_NestedDouble
    • [x] go test -run TestTOMLTest_Valid_Array_NestedInlineTable
    • [x] go test -run TestTOMLTest_Valid_Array_Nested
    • [x] go test -run TestTOMLTest_Valid_Array_Nospaces
    • [x] go test -run TestTOMLTest_Valid_Array_StringQuoteComma2
    • [x] go test -run TestTOMLTest_Valid_Array_StringQuoteComma
    • [x] go test -run TestTOMLTest_Valid_Array_StringWithComma
    • [x] go test -run TestTOMLTest_Valid_Array_Strings
    • [x] go test -run TestTOMLTest_Valid_Array_TableArrayStringBackslash
    • [x] go test -run TestTOMLTest_Valid_Bool_Bool
    • [x] go test -run TestTOMLTest_Valid_Comment_AtEof
    • [x] go test -run TestTOMLTest_Valid_Comment_AtEof2
    • [x] go test -run TestTOMLTest_Valid_Comment_Everywhere
    • [x] go test -run TestTOMLTest_Valid_Comment_Tricky
    • [x] go test -run TestTOMLTest_Valid_Datetime_Datetime
    • [x] go test -run TestTOMLTest_Valid_Datetime_LocalDate
    • [x] go test -run TestTOMLTest_Valid_Datetime_LocalTime
    • [x] go test -run TestTOMLTest_Valid_Datetime_Local
    • [x] go test -run TestTOMLTest_Valid_Datetime_Milliseconds
    • [x] go test -run TestTOMLTest_Valid_Datetime_Timezone
    • [x] go test -run TestTOMLTest_Valid_EmptyFile
    • [x] go test -run TestTOMLTest_Valid_Example
    • [x] go test -run TestTOMLTest_Valid_Float_Exponent
    • [x] go test -run TestTOMLTest_Valid_Float_Float
    • [x] go test -run TestTOMLTest_Valid_Float_InfAndNan
    • [x] go test -run TestTOMLTest_Valid_Float_Long
    • [x] go test -run TestTOMLTest_Valid_Float_Underscore
    • [x] go test -run TestTOMLTest_Valid_Float_Zero
    • [x] go test -run TestTOMLTest_Valid_ImplicitAndExplicitAfter
    • [x] go test -run TestTOMLTest_Valid_ImplicitAndExplicitBefore
    • [x] go test -run TestTOMLTest_Valid_ImplicitGroups
    • [x] go test -run TestTOMLTest_Valid_InlineTable_Array
    • [x] go test -run TestTOMLTest_Valid_InlineTable_Bool
    • [x] go test -run TestTOMLTest_Valid_InlineTable_Empty
    • [x] go test -run TestTOMLTest_Valid_InlineTable_EndInBool
    • [x] go test -run TestTOMLTest_Valid_InlineTable_InlineTable
    • [x] go test -run TestTOMLTest_Valid_InlineTable_KeyDotted
    • [x] go test -run TestTOMLTest_Valid_InlineTable_Multiline
    • [x] go test -run TestTOMLTest_Valid_InlineTable_Nest
    • [x] go test -run TestTOMLTest_Valid_Integer_Integer
    • [x] go test -run TestTOMLTest_Valid_Integer_Literals
    • [x] go test -run TestTOMLTest_Valid_Integer_Long
    • [x] go test -run TestTOMLTest_Valid_Integer_Underscore
    • [x] go test -run TestTOMLTest_Valid_Integer_Zero
    • [x] go test -run TestTOMLTest_Valid_Key_Alphanum
    • [x] go test -run TestTOMLTest_Valid_Key_CaseSensitive
    • [x] go test -run TestTOMLTest_Valid_Key_Dotted
    • [x] go test -run TestTOMLTest_Valid_Key_Empty
    • [x] go test -run TestTOMLTest_Valid_Key_EqualsNospace
    • [x] go test -run TestTOMLTest_Valid_Key_Escapes
    • [x] go test -run TestTOMLTest_Valid_Key_NumericDotted
    • [x] go test -run TestTOMLTest_Valid_Key_Numeric
    • [x] go test -run TestTOMLTest_Valid_Key_QuotedDots
    • [x] go test -run TestTOMLTest_Valid_Key_Space
    • [x] go test -run TestTOMLTest_Valid_Key_SpecialChars
    • [x] go test -run TestTOMLTest_Valid_Key_SpecialWord
    • [x] go test -run TestTOMLTest_Valid_NewlineCrlf
    • [x] go test -run TestTOMLTest_Valid_NewlineLf
    • [x] go test -run TestTOMLTest_Valid_SpecExample1Compact
    • [x] go test -run TestTOMLTest_Valid_SpecExample1
    • [x] go test -run TestTOMLTest_Valid_String_DoubleQuoteEscape
    • [x] go test -run TestTOMLTest_Valid_String_Empty
    • [x] go test -run TestTOMLTest_Valid_String_EscapeTricky
    • [x] go test -run TestTOMLTest_Valid_String_EscapedEscape
    • [x] go test -run TestTOMLTest_Valid_String_Escapes
    • [x] go test -run TestTOMLTest_Valid_String_MultilineQuotes
    • [x] go test -run TestTOMLTest_Valid_String_Multiline
    • [x] go test -run TestTOMLTest_Valid_String_Nl
    • [x] go test -run TestTOMLTest_Valid_String_RawMultiline
    • [x] go test -run TestTOMLTest_Valid_String_Raw
    • [x] go test -run TestTOMLTest_Valid_String_Simple
    • [x] go test -run TestTOMLTest_Valid_String_UnicodeEscape
    • [x] go test -run TestTOMLTest_Valid_String_UnicodeLiteral
    • [x] go test -run TestTOMLTest_Valid_String_WithPound
    • [x] go test -run TestTOMLTest_Valid_Table_ArrayImplicit
    • [x] go test -run TestTOMLTest_Valid_Table_ArrayMany
    • [x] go test -run TestTOMLTest_Valid_Table_ArrayNest
    • [x] go test -run TestTOMLTest_Valid_Table_ArrayOne
    • [x] go test -run TestTOMLTest_Valid_Table_ArrayTableArray
    • [x] go test -run TestTOMLTest_Valid_Table_Empty
    • [x] go test -run TestTOMLTest_Valid_Table_Keyword
    • [x] go test -run TestTOMLTest_Valid_Table_Names
    • [x] go test -run TestTOMLTest_Valid_Table_NoEol
    • [x] go test -run TestTOMLTest_Valid_Table_SubEmpty
    • [x] go test -run TestTOMLTest_Valid_Table_Whitespace
    • [x] go test -run TestTOMLTest_Valid_Table_WithLiteralString
    • [x] go test -run TestTOMLTest_Valid_Table_WithPound
    • [x] go test -run TestTOMLTest_Valid_Table_WithSingleQuotes
    • [x] go test -run TestTOMLTest_Valid_Table_WithoutSuper
    bug good first issue v2 
    opened by pelletier 17
  • Add continuous fuzzing integration via Fuzzit

    Add continuous fuzzing integration via Fuzzit

    Hi @pelletier This is the PR as discussed in https://github.com/pelletier/go-toml/issues/287

    It adds the following:

    • Runs fuzzing continuously on master
    • Runs regression with the generated corpus from the above step on every PR.

    Cheers, Yevgeny

    opened by yevgenypats 15
  • toml.Unmarshal overrides origin values if key is omitted in the file

    toml.Unmarshal overrides origin values if key is omitted in the file

    Describe the bug When unmarshaling to struct that already have some default value toml.Unmarshal overwrites it when key is not present in the file

    To Reproduce Steps to reproduce the behavior. Including TOML files.

    
    package main
    
    import(
    	"github.com/pelletier/go-toml"
    )
    
    type config struct {
    	Val1 string `toml:"val1"`
    	Val2 string `toml:"val2"`
    }
    
    var configFile = []byte(
    	`
    val1 = "test1"
    `)
    
    func main() {
    	cfg := &config {
    		Val2: "test2",
    	}
    
    	err := toml.Unmarshal(configFile, cfg)
    	if err != nil {
    		panic(err.Error())
    	}
    
    	if cfg.Val2 != "test2" {
    		panic("Val2 overwritten")
    	}
    }
    

    Expected behavior Should remain default value if no key is present in the file

    Versions

    • go-toml: b56e1b2
    • go: version 1.11.2
    • operating system: macOS
    bug v2-fixed 
    opened by troian 15
  • Element Position Support

    Element Position Support

    So, this change may be a tad controversial. If you want, we can hash out a better way to do all this if the changeset doesn't fit with what you have in mind for go-toml.

    The motivation for this change was that there is a real need to be able to trace where a given TOML table, and its associated keys, came from in the source file. With that information, the programmer can inform the user of semantic mistakes made in a given TOML file. As an experiment, I'm using this version of the feature on Grapnel: https://github.com/eanderton/grapnel/blob/master/src/grapnel/rewrite.go#L126 Here, this feature is used to inform the user of where they have made grammatical mistakes in regular expressions and templates in strings, that may be embedded deep within a configuration file.

    The first thing I did was modify the parser to record position information from the token stream. This wound up being a parallel structure (PositionMap) that is stored alongside the TomlTree during parsing. After that, I needed a structure to couple those two together for the library user - this became the TomlDocument.

    A quirk of the position storage scheme is that it was not possible to modify the TomlTree, nor the storage of key/value data, without invalidating the current API. As a result, it's necessary to use a key's parent TomlTree pointer in order to find the location of that key in the document. The TomlDocument also provides methods to query this position information using string paths, in order to parallel the path navigation available on the TomlTree itself.


    TomlDocument provides an optional TOML processing path where position informaiton is stored alongside a TomlTree.

    • Added Position struct
    • Added TomlDocument struct
    • Revised parser to emit position data
    • Revised LoadFile() and Load() to use revised parser
    • Revised token to use new Position struct
    • Added tests for new functionality
    • Bugfixed table array duplicate key handling
    • Applied gofmt to all code
    opened by eanderton 14
  • add value string representation pub function

    add value string representation pub function

    fix #468

    Issue: add link to pelletier/go-toml issue here

    Explanation of what this pull request does.

    More detailed description of the decisions being made and the reasons why (if the patch is non-trivial).

    opened by vincentserpoul 13
  • Add compiled binaries to releases

    Add compiled binaries to releases

    Is your feature request related to a problem? Please describe.

    I'd like to be able to use the tomljson binary in a heroku buildpack to parse toml files from a Julia project. At the moment, I need to install Golang and then manually compile tomljson, which adds extra time to my app deploy.

    Describe the solution you'd like

    It would be great if each release on github also had the built binaries (for Darwin and Linux) attached to them, that way I could download the binary as necessary.

    Describe alternatives you've considered

    The alternative is to manually build and compile these, but having them with the release would be a nice way for others to ensure they aren't getting lord-knows-what from my buildpack. In essence, we are trusting you, as the library developer, to build the right thing :)

    build 
    opened by josegonzalez 12
  • return error

    return error "incorrect date/time separation character:" when add new line after local date

    Describe the bug return error "incorrect date/time separation character:" when add new line after local date

    To Reproduce

    // ok
    "foo = 2021-04-08"  
    
    // error
    `
    foo = 2021-04-08
    bar = 2021-04-08
    `
    

    v1.8.1 is ok, but v1.9.0 will return error

    Expected behavior not return error

    Versions

    • go-toml: v1.9.0
    • go: go1.16.3
    • operating system: Windows

    Additional context no

    bug v2-fixed 
    opened by For-ACGN 10
  • Unmarshal leads to panic

    Unmarshal leads to panic

    Describe the bug my config.toml includes accidently [[devices]] and [[meters]] instead of [[device]] and [[meter]] (note the missing "s"). I expect to get an err, not a kernel panic. Seems that there is something wrong with regex or substrings?

    To Reproduce

    type MeterConfig struct {
    	ID       int `json:"id" toml:"id"`
    	Register int `json:"register" toml:"register"`
    	OldID    int `json:"old_id,omitempty" toml:"-"`
    }
    
    type DeviceConfig struct {
    	Name       string `toml:"name"`
    	SerialPath string `toml:"serial_path"`
    	LinkMode   string `toml:"link_mode"`
    }
    
    type Config struct {
    	Meter  []MeterConfig  `toml:"meter"`
    	Device []DeviceConfig `toml:"device"`
    	Title  string         `toml:"title"`
    }
    
    title = "foo"
    
    [[devices]]
    name = "xyz"
    serial_path = "/dev/ttyUSB0"
    link_mode = "C1"
    
    [[meters]]
    id = 12345678
    register = 12345
    
    
    func readConfig(path string) (Config, error) {
    	wmbusConfig, err := ioutil.ReadFile(path)
    	if err != nil {
    		return Config{}, err
    	}
    
    	config := Config{}
    	err = toml.Unmarshal(wmbusConfig, &config)  <--------------------kernel panic
    	if err != nil {
    		return Config{}, err
    	}
    
    	return config, nil
    }
    
    

    Versions

    • go-toml: v1.8.1
    • go: 1.14
    • operating system: Linux
    opened by chrisquin 9
  • go-toml/v2 silently ignores array type mismatches during unmarshal

    go-toml/v2 silently ignores array type mismatches during unmarshal

    To Reproduce

    package main
    
    import (
    	"fmt"
    	"github.com/pelletier/go-toml/v2"
    )
    
    const testTOML = `
    # notice the double brackets
    [[test]]
    answer = 42
    `
    
    func main() {
    	var s struct {
    		// should be []map[string]int
    		Test map[string]int `toml:"test"`
    	}
    	fmt.Printf("err: %+v\n\nret: %+v\n\n",
    		toml.Unmarshal([]byte(testTOML), &s), &s)
    }
    

    Expected behavior

    github.com/pelletier/go-toml v1.9.5 (remove the /v2 suffix from the imports in the example snippet above):

    err: (3, 1): Can't convert [answer = 42
    ]([]*toml.Tree) to trees
    
    ret: &{Test:map[]}
    

    Actual behavior

    github.com/pelletier/go-toml/v2 v2.0.2:

    err: <nil>
    
    ret: &{Test:map[answer:42]}
    

    Versions

    • go-toml v2.0.2 (i.e. 216628222f5716163bb96d3651a68feef31b090d)
    • go version go1.18.4 darwin/amd64 (i.e. macOS)
    opened by Arnie97 0
  • Support RawMessage for Partial Field Structs

    Support RawMessage for Partial Field Structs

    Describe the bug Feature Request (or question if already possible):

    I'd like to be able to parse a struct w/ partial fields defined and have go-toml v2 Unmarshal into the fields defined in the struct and store the rest of the TOML into a []byte. The go json pkg has this capability by embedding the json.RawMessage type (a []byte) on the struct.

    To Reproduce Steps to reproduce the behavior. Including TOML files.

    https://go.dev/play/p/5KE5CeRhXPB

    package main
    
    import (
    	"fmt"
    	"os"
    
    	"github.com/pelletier/go-toml/v2"
    )
    
    type RawMessage []byte
    type Doc struct {
    	Test struct {
    		Key string `toml:"key"`
    		RawMessage
    	} `toml:"test"`
    }
    
    func main() {
    	d := Doc{}
    	if err := toml.Unmarshal([]byte(`
             [test]
             key = 'test'
             undefined-key = 'not here'
            `), &d); err != nil {
    		fmt.Printf("error :( -> %v", err)
    		os.Exit(1)
    	}
    	fmt.Printf("%+v", d)
    }
    
    

    output:

    panic: reflect: NumField of non-struct type main.RawMessage
    ...
    

    Expected behavior A clear and concise description of what you expected to happen, if other than "should work".

    The output of the snippet above should be something like this:

    {Test:{Key:test, RawMessage: undefined-key = 'not here'}}
    

    Versions

    • go-toml: version (git sha) -> github.com/pelletier/go-toml/v2 v2.0.2 (216628222f5716163bb96d3651a68feef31b090d)
    • go: version -> go version go1.18.1 darwin/amd64
    • operating system: e.g. macOS, Windows, Linux -> macOS

    Additional context Add any other context about the problem here that you think may help to diagnose.

    feature 
    opened by bwagner5 2
  • Questionable behavior of 'omitempty' tag

    Questionable behavior of 'omitempty' tag

    Describe the bug Hello. I see the current behavior of omitempty flag as a bit confusing because of a few factors:

    1. It creates empty lines at the place records should be
    2. For the slices of structures it's inherited and changes existing tags of embedded structures

    To Reproduce

    package main
    
    import (
    	"bytes"
    	"fmt"
    
    	"github.com/pelletier/go-toml/v2"
    )
    
    type General struct {
    	From      string `toml:"from,omitempty" json:"from,omitempty" comment:"from in graphite-web format, the local TZ is used"`
    	Randomize bool   `toml:"randomize" json:"randomize" comment:"randomize starting time with [0,step)"`
    }
    
    type Custom struct {
    	Name string `toml:"name" json:"name,omitempty" comment:"names for generator, braces are expanded like in shell"`
    	Type string `toml:"type" json:"type,omitempty" comment:"type of generator"`
    	General
    }
    type Config struct {
    	General
    	Custom []Custom `toml:"custom,omitempty" json:"custom,omitempty" comment:"generators with custom parameters can be specified separately"`
    }
    
    func main() {
    	buf := new(bytes.Buffer)
    	config := &Config{General: General{From: "-2d", Randomize: true}}
    	config.Custom = []Custom{{Name: "omit", General: General{Randomize: false}}}
    	config.Custom = append(config.Custom, Custom{Name: "present", General: General{From: "-2d", Randomize: true}})
    	encoder := toml.NewEncoder(buf)
    	encoder.Encode(config)
    	fmt.Print(buf.String())
    }
    

    it produces (includes empty line on the end)

    # from in graphite-web format, the local TZ is used
    from = '-2d'
    # randomize starting time with [0,step)
    randomize = true
    # generators with custom parameters can be specified separately
    [[custom]]
    # names for generator, braces are expanded like in shell
    name = 'omit'
    
    
    
    [[custom]]
    # names for generator, braces are expanded like in shell
    name = 'present'
    
    # from in graphite-web format, the local TZ is used
    from = '-2d'
    # randomize starting time with [0,step)
    randomize = true
    
    

    Expected behavior I expect another result:

    # from in graphite-web format, the local TZ is used
    from = '-2d'
    # randomize starting time with [0,step)
    randomize = true
    # generators with custom parameters can be specified separately
    [[custom]]
    # names for generator, braces are expanded like in shell
    name = 'omit'
    # randomize starting time with [0,step)
    randomize = false
    [[custom]]
    # names for generator, braces are expanded like in shell
    name = 'present'
    # from in graphite-web format, the local TZ is used
    from = '-2d'
    # randomize starting time with [0,step)
    randomize = true
    

    Versions

    • go-toml: version from go.sum: github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU=
    • go: go1.18.3 linux/amd64
    • operating system: linux

    Additional context Add any other context about the problem here that you think may help to diagnose.

    bug 
    opened by Felixoid 5
  • Specialize navigating map[string]interface{}

    Specialize navigating map[string]interface{}

    This is a common type. Specializing it to reduce the use of reflection yields better performance.

    Similar to https://github.com/pelletier/go-toml/pull/669, there is a lot to explore there.

    The overall structure of unmarshal.go will need to change to make this reasonable in terms of maintenance. But given the results it's probably worth it overall.

    goos: darwin
    goarch: arm64
    pkg: github.com/pelletier/go-toml/v2/benchmark
    
    name                               old time/op    new time/op    delta
    UnmarshalDataset/config-8            13.3ms ± 0%    10.9ms ± 0%  -17.97%  (p=0.008 n=5+5)
    UnmarshalDataset/canada-8            55.7ms ± 0%    55.4ms ± 1%     ~     (p=0.056 n=5+5)
    UnmarshalDataset/citm_catalog-8      16.6ms ± 1%    15.7ms ± 0%   -5.36%  (p=0.008 n=5+5)
    UnmarshalDataset/twitter-8           7.10ms ± 1%    6.63ms ± 0%   -6.55%  (p=0.008 n=5+5)
    UnmarshalDataset/code-8              63.8ms ± 0%    48.7ms ± 2%  -23.69%  (p=0.008 n=5+5)
    UnmarshalDataset/example-8            121µs ± 0%     110µs ± 3%   -8.79%  (p=0.008 n=5+5)
    Unmarshal/SimpleDocument/struct-8     438ns ± 1%     431ns ± 1%   -1.76%  (p=0.008 n=5+5)
    Unmarshal/SimpleDocument/map-8        594ns ± 2%     540ns ± 1%   -9.00%  (p=0.008 n=5+5)
    Unmarshal/ReferenceFile/struct-8     34.3µs ± 1%    33.6µs ± 0%   -2.14%  (p=0.008 n=5+5)
    Unmarshal/ReferenceFile/map-8        48.6µs ± 0%    41.7µs ± 1%  -14.34%  (p=0.008 n=5+5)
    Unmarshal/HugoFrontMatter-8          7.88µs ± 1%    6.74µs ± 1%  -14.51%  (p=0.008 n=5+5)
    [Geo mean]                            307µs          277µs        -9.80%
    
    name                               old speed      new speed      delta
    UnmarshalDataset/config-8          78.9MB/s ± 0%  96.1MB/s ± 0%  +21.90%  (p=0.008 n=5+5)
    UnmarshalDataset/canada-8          39.5MB/s ± 0%  39.8MB/s ± 1%     ~     (p=0.056 n=5+5)
    UnmarshalDataset/citm_catalog-8    33.6MB/s ± 1%  35.5MB/s ± 0%   +5.66%  (p=0.008 n=5+5)
    UnmarshalDataset/twitter-8         62.3MB/s ± 1%  66.6MB/s ± 0%   +7.02%  (p=0.008 n=5+5)
    UnmarshalDataset/code-8            42.1MB/s ± 0%  55.1MB/s ± 2%  +31.06%  (p=0.008 n=5+5)
    UnmarshalDataset/example-8         66.9MB/s ± 0%  73.4MB/s ± 3%   +9.68%  (p=0.008 n=5+5)
    Unmarshal/SimpleDocument/struct-8  25.1MB/s ± 1%  25.5MB/s ± 1%   +1.79%  (p=0.008 n=5+5)
    Unmarshal/SimpleDocument/map-8     18.5MB/s ± 2%  20.4MB/s ± 1%   +9.91%  (p=0.008 n=5+5)
    Unmarshal/ReferenceFile/struct-8    153MB/s ± 1%   156MB/s ± 0%   +2.19%  (p=0.008 n=5+5)
    Unmarshal/ReferenceFile/map-8       108MB/s ± 0%   126MB/s ± 1%  +16.73%  (p=0.008 n=5+5)
    Unmarshal/HugoFrontMatter-8        69.3MB/s ± 1%  81.0MB/s ± 1%  +16.97%  (p=0.008 n=5+5)
    [Geo mean]                         53.2MB/s       59.0MB/s       +10.87%
    
    name                               old alloc/op   new alloc/op   delta
    UnmarshalDataset/config-8            5.86MB ± 0%    4.75MB ± 0%  -19.02%  (p=0.008 n=5+5)
    UnmarshalDataset/canada-8            83.0MB ± 0%    83.0MB ± 0%   -0.00%  (p=0.008 n=5+5)
    UnmarshalDataset/citm_catalog-8      34.7MB ± 0%    34.3MB ± 0%   -1.17%  (p=0.008 n=5+5)
    UnmarshalDataset/twitter-8           12.7MB ± 0%    12.5MB ± 0%   -1.44%  (p=0.008 n=5+5)
    UnmarshalDataset/code-8              22.2MB ± 0%    13.9MB ± 0%  -37.19%  (p=0.008 n=5+5)
    UnmarshalDataset/example-8            186kB ± 0%     182kB ± 0%   -2.24%  (p=0.008 n=5+5)
    Unmarshal/SimpleDocument/struct-8      805B ± 0%      805B ± 0%     ~     (all equal)
    Unmarshal/SimpleDocument/map-8       1.13kB ± 0%    1.12kB ± 0%   -1.41%  (p=0.008 n=5+5)
    Unmarshal/ReferenceFile/struct-8     20.9kB ± 0%    20.9kB ± 0%     ~     (all equal)
    Unmarshal/ReferenceFile/map-8        38.2kB ± 0%    35.4kB ± 0%     ~     (p=0.079 n=4+5)
    Unmarshal/HugoFrontMatter-8          7.44kB ± 0%    6.98kB ± 0%   -6.24%  (p=0.008 n=5+5)
    [Geo mean]                            328kB          303kB        -7.69%
    
    name                               old allocs/op  new allocs/op  delta
    UnmarshalDataset/config-8              227k ± 0%      157k ± 0%  -30.73%  (p=0.029 n=4+4)
    UnmarshalDataset/canada-8              782k ± 0%      782k ± 0%   -0.00%  (p=0.008 n=5+5)
    UnmarshalDataset/citm_catalog-8        192k ± 0%      167k ± 0%  -13.18%  (p=0.008 n=5+5)
    UnmarshalDataset/twitter-8            56.9k ± 0%     45.5k ± 0%  -20.02%  (p=0.000 n=5+4)
    UnmarshalDataset/code-8               1.05M ± 0%     0.54M ± 0%  -48.97%  (p=0.008 n=5+5)
    UnmarshalDataset/example-8            1.36k ± 0%     1.11k ± 0%  -18.65%  (p=0.008 n=5+5)
    Unmarshal/SimpleDocument/struct-8      9.00 ± 0%      9.00 ± 0%     ~     (all equal)
    Unmarshal/SimpleDocument/map-8         13.0 ± 0%      12.0 ± 0%   -7.69%  (p=0.008 n=5+5)
    Unmarshal/ReferenceFile/struct-8        183 ± 0%       183 ± 0%     ~     (all equal)
    Unmarshal/ReferenceFile/map-8           642 ± 0%       466 ± 0%  -27.41%  (p=0.008 n=5+5)
    Unmarshal/HugoFrontMatter-8             141 ± 0%       112 ± 0%  -20.57%  (p=0.008 n=5+5)
    [Geo mean]                            4.09k          3.34k       -18.44%
    
    performance 
    opened by pelletier 0
  • Decode: slices specialization

    Decode: slices specialization

    Taking a shot at specializing unmarshal code to work on concrete types instead of fully in reflect land.

    At the moment I experimented with UnmarshalArray, as it has simpler semantics than the rest. I only specialized unmarshaling into []interface{}.

    Results are quite encouraging!


    name                               old time/op    new time/op     delta
    UnmarshalDataset/config-2            24.3ms ± 1%     24.0ms ± 0%   -1.06%  (p=0.008 n=5+5)
    UnmarshalDataset/canada-2            85.8ms ± 0%     66.2ms ± 0%  -22.87%  (p=0.008 n=5+5)
    UnmarshalDataset/citm_catalog-2      27.2ms ± 3%     25.5ms ± 0%   -6.29%  (p=0.008 n=5+5)
    UnmarshalDataset/twitter-2           10.8ms ± 2%     10.8ms ± 2%     ~     (p=0.548 n=5+5)
    UnmarshalDataset/code-2               107ms ± 1%      108ms ± 7%     ~     (p=0.841 n=5+5)
    UnmarshalDataset/example-2            181µs ± 2%      177µs ± 0%   -2.15%  (p=0.008 n=5+5)
    Unmarshal/SimpleDocument/struct-2     530ns ± 1%      542ns ± 0%   +2.23%  (p=0.008 n=5+5)
    Unmarshal/SimpleDocument/map-2        807ns ± 1%      812ns ± 0%     ~     (p=0.151 n=5+5)
    Unmarshal/ReferenceFile/struct-2     53.6µs ± 2%     52.2µs ± 0%   -2.69%  (p=0.008 n=5+5)
    Unmarshal/ReferenceFile/map-2        82.5µs ± 0%     79.7µs ± 0%   -3.46%  (p=0.016 n=4+5)
    Unmarshal/HugoFrontMatter-2          14.6µs ± 3%     13.6µs ± 0%   -6.31%  (p=0.008 n=5+5)
    
    name                               old speed      new speed       delta
    UnmarshalDataset/config-2          43.1MB/s ± 1%   43.6MB/s ± 0%   +1.08%  (p=0.008 n=5+5)
    UnmarshalDataset/canada-2          25.7MB/s ± 0%   33.3MB/s ± 0%  +29.66%  (p=0.008 n=5+5)
    UnmarshalDataset/citm_catalog-2    20.6MB/s ± 3%   21.9MB/s ± 0%   +6.68%  (p=0.008 n=5+5)
    UnmarshalDataset/twitter-2         40.9MB/s ± 2%   40.8MB/s ± 2%     ~     (p=0.548 n=5+5)
    UnmarshalDataset/code-2            25.0MB/s ± 1%   24.8MB/s ± 6%     ~     (p=0.841 n=5+5)
    UnmarshalDataset/example-2         44.7MB/s ± 2%   45.7MB/s ± 0%   +2.20%  (p=0.008 n=5+5)
    Unmarshal/SimpleDocument/struct-2  20.8MB/s ± 1%   20.3MB/s ± 0%   -2.19%  (p=0.008 n=5+5)
    Unmarshal/SimpleDocument/map-2     13.6MB/s ± 1%   13.5MB/s ± 0%     ~     (p=0.159 n=5+5)
    Unmarshal/ReferenceFile/struct-2   97.8MB/s ± 2%  100.5MB/s ± 0%   +2.74%  (p=0.008 n=5+5)
    Unmarshal/ReferenceFile/map-2      63.5MB/s ± 0%   65.8MB/s ± 0%   +3.59%  (p=0.016 n=4+5)
    Unmarshal/HugoFrontMatter-2        37.5MB/s ± 3%   40.0MB/s ± 0%   +6.71%  (p=0.008 n=5+5)
    
    name                               old alloc/op   new alloc/op    delta
    UnmarshalDataset/config-2            5.92MB ± 0%     5.85MB ± 0%   -1.05%  (p=0.008 n=5+5)
    UnmarshalDataset/canada-2            84.4MB ± 0%     77.3MB ± 0%   -8.34%  (p=0.008 n=5+5)
    UnmarshalDataset/citm_catalog-2      35.8MB ± 0%     35.3MB ± 0%   -1.33%  (p=0.008 n=5+5)
    UnmarshalDataset/twitter-2           13.5MB ± 0%     13.5MB ± 0%   -0.17%  (p=0.008 n=5+5)
    UnmarshalDataset/code-2              22.3MB ± 0%     22.3MB ± 0%     ~     (p=0.135 n=5+5)
    UnmarshalDataset/example-2            205kB ± 0%      204kB ± 0%   -0.55%  (p=0.008 n=5+5)
    Unmarshal/SimpleDocument/struct-2      581B ± 0%       581B ± 0%     ~     (all equal)
    Unmarshal/SimpleDocument/map-2         957B ± 0%       957B ± 0%     ~     (all equal)
    Unmarshal/ReferenceFile/struct-2     20.8kB ± 0%     20.5kB ± 0%   -1.46%  (p=0.008 n=5+5)
    Unmarshal/ReferenceFile/map-2        38.1kB ± 0%     37.1kB ± 0%   -2.62%  (p=0.000 n=4+5)
    Unmarshal/HugoFrontMatter-2          7.38kB ± 0%     7.14kB ± 0%   -3.25%  (p=0.008 n=5+5)
    
    name                               old allocs/op  new allocs/op   delta
    UnmarshalDataset/config-2              233k ± 0%       230k ± 0%   -1.33%  (p=0.008 n=5+5)
    UnmarshalDataset/canada-2              782k ± 0%       447k ± 0%  -42.78%  (p=0.008 n=5+5)
    UnmarshalDataset/citm_catalog-2        192k ± 0%       169k ± 0%  -12.38%  (p=0.008 n=5+5)
    UnmarshalDataset/twitter-2            56.9k ± 0%      55.8k ± 0%   -2.00%  (p=0.008 n=5+5)
    UnmarshalDataset/code-2               1.06M ± 0%      1.06M ± 0%     ~     (all equal)
    UnmarshalDataset/example-2            1.36k ± 0%      1.31k ± 0%   -4.10%  (p=0.008 n=5+5)
    Unmarshal/SimpleDocument/struct-2      7.00 ± 0%       7.00 ± 0%     ~     (all equal)
    Unmarshal/SimpleDocument/map-2         12.0 ± 0%       12.0 ± 0%     ~     (all equal)
    Unmarshal/ReferenceFile/struct-2        182 ± 0%        167 ± 0%   -8.24%  (p=0.008 n=5+5)
    Unmarshal/ReferenceFile/map-2           649 ± 0%        599 ± 0%   -7.70%  (p=0.008 n=5+5)
    Unmarshal/HugoFrontMatter-2             143 ± 0%        131 ± 0%   -8.39%  (p=0.008 n=5+5)
    
    
    performance 
    opened by pelletier 2
  • Contextualize redefinition errors

    Contextualize redefinition errors

    Follow up to #667. When SeenTracker finds a duplicate in the document structure it returns a simple error with no context. For example:

    toml: key b is already defined
    

    We should also provide more context about where the error occurred in the document, maybe the current path to the key at fault, possibly the source of the error (like where was the original key that just got redefined), similar to DecodeError (maybe should just reuse it?).

    feature 
    opened by pelletier 0
Releases(v2.0.2)
  • v2.0.1(May 10, 2022)

    What's Changed

    Fixed bugs

    • Encode: fix embedded struct with explicit field name by @pelletier in https://github.com/pelletier/go-toml/pull/773
    • Encode: fix multiline comment by @pelletier in https://github.com/pelletier/go-toml/pull/775
    • Encode: support comment on array tables by @pelletier in https://github.com/pelletier/go-toml/pull/776
    • Decode: check max uint on 32 bit platforms by @pelletier in https://github.com/pelletier/go-toml/pull/778

    Documentation

    • Typo in README.md fix by @fnork in https://github.com/pelletier/go-toml/pull/770

    New Contributors

    • @fnork made their first contribution in https://github.com/pelletier/go-toml/pull/770

    Full Changelog: https://github.com/pelletier/go-toml/compare/v2.0.0...v2.0.1

    Source code(tar.gz)
    Source code(zip)
    jsontoml_2.0.1_darwin_all.tar.xz(2.56 MB)
    jsontoml_2.0.1_linux_amd64.tar.xz(1.37 MB)
    jsontoml_2.0.1_windows_amd64.tar.xz(1.43 MB)
    sha256sums.txt(894 bytes)
    tomljson_2.0.1_darwin_all.tar.xz(2.68 MB)
    tomljson_2.0.1_linux_amd64.tar.xz(1.43 MB)
    tomljson_2.0.1_windows_amd64.tar.xz(1.49 MB)
    tomll_2.0.1_darwin_all.tar.xz(2.57 MB)
    tomll_2.0.1_linux_amd64.tar.xz(1.38 MB)
    tomll_2.0.1_windows_amd64.tar.xz(1.44 MB)
  • v2.0.0(Apr 28, 2022)

    It is finally here! go-toml v2 is now stable. :tada:

    Only just over one year after I started working on it. This version of go-toml has been rebuilt from the ground up. It respects the latest TOML specification. Countless bugs have been fixed. It behaves more like the standard library. And it is much faster. Special attention was given to keeping the public API to a minimum. Continuing the strict policy of backward compatibility, the next breaking change will be in another 5 years!

    Thank you to everybody who contributed to this new version, as well as folks willing to try out the intermediate beta versions. Shout out to @moorereason for reporting many issues during the development process using differential fuzzing, as well as @bep for running a beta on the popular Hugo project!

    There is still some work that could be done to improve the performance of the library (https://github.com/pelletier/go-toml/pull/758 and https://github.com/pelletier/go-toml/pull/669 for instance). But I am confident that the library is in a good-enough place at the moment for folks to reap the benefits of the rewrite. The major feature removal is the sort-of-AST that v1 provided. It allowed manipulating an arbitrary document and writing it back out. This was done to cut down the scope of the project, removing a feature that had unclear use-cases. The v2 parser creates some intermediate AST so that if somebody is up to design a Document API the tools should be available to do so. Please reach out if you are interested!

    The readme contains a list of differences between v1 and v2 to be aware of when upgrading. Please report any issue you may have with the new version in the bug tracker 🐞, provide feedback, and ask questions in Discussions 💬. With this release, go-toml v1 will not be receiving any updates. This is required to keep maintenance of the project to a minimum.

    Hopefully, this change doesn't break your thing!


    Full commit log: https://github.com/pelletier/go-toml/compare/c9a09d8695a83a55cd171d147b09fdf10270e503...v2

    Thank you contributors: @pelletier @oschwald @moorereason @xwjdsh @kkHAIKE @RiyaJohn @jidicula @zostay @mmorel-35.

    Source code(tar.gz)
    Source code(zip)
    jsontoml_2.0.0_darwin_all.tar.xz(2.56 MB)
    jsontoml_2.0.0_linux_amd64.tar.xz(1.37 MB)
    jsontoml_2.0.0_windows_amd64.tar.xz(1.43 MB)
    sha256sums.txt(894 bytes)
    tomljson_2.0.0_darwin_all.tar.xz(2.68 MB)
    tomljson_2.0.0_linux_amd64.tar.xz(1.43 MB)
    tomljson_2.0.0_windows_amd64.tar.xz(1.49 MB)
    tomll_2.0.0_darwin_all.tar.xz(2.57 MB)
    tomll_2.0.0_linux_amd64.tar.xz(1.38 MB)
    tomll_2.0.0_windows_amd64.tar.xz(1.44 MB)
  • v2.0.0-beta.8(Apr 11, 2022)

    Lots of small bug fixes on the encoder. Found thanks to the new Go 1.18 fuzzing support.

    What's Changed

    Fixed bugs

    • Decode: always use UTC for +00:00 timezone by @pelletier in https://github.com/pelletier/go-toml/pull/755
    • Encode: fix LocalDate formatting by @pelletier in https://github.com/pelletier/go-toml/pull/755
    • Encode: fix empty key marshaling by @pelletier in https://github.com/pelletier/go-toml/pull/755
    • Encode: fix invalid quotation of time.Time by @pelletier in https://github.com/pelletier/go-toml/pull/755
    • Encode: ensure control characters are escaped by @pelletier in https://github.com/pelletier/go-toml/pull/755
    • Encode: check for invalid characters in keys by @pelletier in https://github.com/pelletier/go-toml/pull/755
    • Encode: always construct map for empty array tables by @pelletier in https://github.com/pelletier/go-toml/pull/755
    • Encode: don't capitalize nan by @pelletier in https://github.com/pelletier/go-toml/pull/755
    • Encode: don't capitalize inf by @pelletier in https://github.com/pelletier/go-toml/pull/755
    • Encode: allow new lines in quoted keys by @pelletier in https://github.com/pelletier/go-toml/pull/755
    • Encode: never emit table inside array by @pelletier in https://github.com/pelletier/go-toml/pull/755
    • Encode: fix embedded interfaces by @pelletier in https://github.com/pelletier/go-toml/pull/753

    Documentation

    • Update benchmarks in README by @pelletier in https://github.com/pelletier/go-toml/pull/756

    Full Changelog: https://github.com/pelletier/go-toml/compare/v2.0.0-beta.7...v2.0.0-beta.8

    Source code(tar.gz)
    Source code(zip)
    jsontoml_2.0.0-beta.8_darwin_all.tar.xz(2.56 MB)
    jsontoml_2.0.0-beta.8_linux_amd64.tar.xz(1.37 MB)
    jsontoml_2.0.0-beta.8_windows_amd64.tar.xz(1.43 MB)
    sha256sums.txt(957 bytes)
    tomljson_2.0.0-beta.8_darwin_all.tar.xz(2.68 MB)
    tomljson_2.0.0-beta.8_linux_amd64.tar.xz(1.43 MB)
    tomljson_2.0.0-beta.8_windows_amd64.tar.xz(1.49 MB)
    tomll_2.0.0-beta.8_darwin_all.tar.xz(2.57 MB)
    tomll_2.0.0-beta.8_linux_amd64.tar.xz(1.38 MB)
    tomll_2.0.0-beta.8_windows_amd64.tar.xz(1.44 MB)
  • v2.0.0-beta.7(Apr 8, 2022)

    Small bug fixes version. The main purpose is to provide a valid tag to take a recent dependency on, as 2.0.0-beta.6 had issues (https://github.com/pelletier/go-toml/issues/743).

    What's Changed

    What's new

    • Decode: support \e escape sequence by @pelletier in https://github.com/pelletier/go-toml/pull/748

    Fixed bugs

    • tools: display error context when it exists by @pelletier in https://github.com/pelletier/go-toml/pull/749
    • Decode: allow subtables to be defined later in the document by @pelletier in https://github.com/pelletier/go-toml/pull/750

    Other changes

    • Decode: remove mention of UnmarshalText in errors by @pelletier in https://github.com/pelletier/go-toml/pull/751

    Full Changelog: https://github.com/pelletier/go-toml/compare/v2.0.0-beta.6...v2.0.0-beta.7

    Source code(tar.gz)
    Source code(zip)
    jsontoml_2.0.0-beta.7_darwin_all.tar.xz(2.55 MB)
    jsontoml_2.0.0-beta.7_linux_amd64.tar.xz(1.37 MB)
    jsontoml_2.0.0-beta.7_windows_amd64.tar.xz(1.43 MB)
    sha256sums.txt(957 bytes)
    tomljson_2.0.0-beta.7_darwin_all.tar.xz(2.68 MB)
    tomljson_2.0.0-beta.7_linux_amd64.tar.xz(1.43 MB)
    tomljson_2.0.0-beta.7_windows_amd64.tar.xz(1.49 MB)
    tomll_2.0.0-beta.7_darwin_all.tar.xz(2.57 MB)
    tomll_2.0.0-beta.7_linux_amd64.tar.xz(1.38 MB)
    tomll_2.0.0-beta.7_windows_amd64.tar.xz(1.44 MB)
  • v2.0.0-beta.6(Apr 8, 2022)

    Long time this the last beta release! This one comes with all the tooling and build systems ported to v2. And a handful of bug-fixes as usual.

    ⚠️ The v2.0.0-beta.6 tag has been moved, so it is possible you see a checksum mismatch error from Go when using this version (https://github.com/pelletier/go-toml/issues/743). This will be correct in v2.0.0-beta.7.

    What's Changed

    Fixed bugs

    • Decode: use cleaned byte slice throughout parseFloat by @moorereason in https://github.com/pelletier/go-toml/pull/735
    • Decode: convert table key to correct type by @oschwald in https://github.com/pelletier/go-toml/pull/741
    • Encoder: respect stdlib rules for embedded structs by @pelletier in https://github.com/pelletier/go-toml/pull/747

    Documentation

    • Mention removal of go-toml/query by @pelletier in https://github.com/pelletier/go-toml/pull/736

    Other changes

    • tomljson: port to v2 by @pelletier in https://github.com/pelletier/go-toml/pull/725
    • jsontoml: port to v2 by @pelletier in https://github.com/pelletier/go-toml/pull/726
    • tomll: port to v2 by @pelletier in https://github.com/pelletier/go-toml/pull/727
    • Decoder: rename SetStrict to DisallowUnknownFields by @pelletier in https://github.com/pelletier/go-toml/pull/731
    • Go 1.18 by @pelletier in https://github.com/pelletier/go-toml/pull/745
    • Update testify dependency by @pelletier in https://github.com/pelletier/go-toml/pull/746

    Full Changelog: https://github.com/pelletier/go-toml/compare/v2.0.0-beta.5...v2.0.0-beta.6

    Source code(tar.gz)
    Source code(zip)
    jsontoml_2.0.0-beta.6_darwin_all.tar.xz(2.52 MB)
    jsontoml_2.0.0-beta.6_linux_amd64.tar.xz(1.35 MB)
    jsontoml_2.0.0-beta.6_windows_amd64.tar.xz(1.41 MB)
    sha256sums.txt(957 bytes)
    tomljson_2.0.0-beta.6_darwin_all.tar.xz(2.67 MB)
    tomljson_2.0.0-beta.6_linux_amd64.tar.xz(1.43 MB)
    tomljson_2.0.0-beta.6_windows_amd64.tar.xz(1.49 MB)
    tomll_2.0.0-beta.6_darwin_all.tar.xz(2.57 MB)
    tomll_2.0.0-beta.6_linux_amd64.tar.xz(1.38 MB)
    tomll_2.0.0-beta.6_windows_amd64.tar.xz(1.44 MB)
  • v1.9.5(Apr 21, 2022)

    What's Changed

    • support parsing uint64 by @xwjdsh in https://github.com/pelletier/go-toml/pull/608
    • Fix invalid type assertion in LoadBytes by @moorereason in https://github.com/pelletier/go-toml/pull/733

    New Contributors

    • @xwjdsh made their first contribution in https://github.com/pelletier/go-toml/pull/608

    Full Changelog: https://github.com/pelletier/go-toml/compare/v1.9.4...v1.9.5

    Source code(tar.gz)
    Source code(zip)
  • v2.0.0-beta.5(Dec 29, 2021)

    While this release focused on adding back missing encoder and decoder features, it also comes with a slew of bug fixes, thanks to @moorereason's awesome differential fuzzing work! This is the last planned pre-release dedicated to the core library. Check out the updated readme for upgrade instructions.

    The next milestone is to port the existing tooling (tomljson, tomllint, binary releases) to go-toml v2.

    Thank you, and happy holidays!

    What's Changed

    What's new

    • API: Encoder and Decoder options are chainable by @pelletier in https://github.com/pelletier/go-toml/pull/670
    • Decoder: show struct field in type mismatch errors by @pelletier in https://github.com/pelletier/go-toml/pull/684
    • Encoder: omitempty flag by @pelletier in https://github.com/pelletier/go-toml/pull/692
    • Decoder: allow commas in tags by @pelletier in https://github.com/pelletier/go-toml/pull/693
    • Decoder: time allows extra precision by @pelletier in https://github.com/pelletier/go-toml/pull/710
    • Encode: add comment struct tag by @pelletier in https://github.com/pelletier/go-toml/pull/711

    Performance

    • Decoder: use lookup table to validate ASCII by @pelletier in https://github.com/pelletier/go-toml/pull/654
    • Decode: code cleanup for struct cache by @pelletier in https://github.com/pelletier/go-toml/pull/659

    Fixed bugs

    • Decode: error on underscore before exponent in floats by @pelletier in https://github.com/pelletier/go-toml/pull/647
    • Decode: add missing checks for LocalTime by @pelletier in https://github.com/pelletier/go-toml/pull/650
    • Decoder: flag invalid carriage returns in strings by @pelletier in https://github.com/pelletier/go-toml/pull/652
    • Decode: correctly handle carriage return in comments by @pelletier in https://github.com/pelletier/go-toml/pull/656
    • Decode: prevent comments that look like dates to be accepted by @pelletier in https://github.com/pelletier/go-toml/pull/657
    • Decoder: validate inline tables don't redefine keys by @pelletier in https://github.com/pelletier/go-toml/pull/660
    • Decoder: validate inline tables in arrays don't redefine keys by @pelletier in https://github.com/pelletier/go-toml/pull/663
    • Decode: accept E as exponent notation by @moorereason in https://github.com/pelletier/go-toml/pull/665
    • Decoder: prevent duplicates of inline tables by @pelletier in https://github.com/pelletier/go-toml/pull/667
    • Decoder: flag invalid carriage returns in literal strings by @moorereason in https://github.com/pelletier/go-toml/pull/673
    • Encoder: try to use pointer type TextMarshaler by @pelletier in https://github.com/pelletier/go-toml/pull/679
    • Decoder: validate bounds of day and month in dates by @pelletier in https://github.com/pelletier/go-toml/pull/680
    • Decoder: fail on unescaped \r not followed by \n by @pelletier in https://github.com/pelletier/go-toml/pull/681
    • Decoder: fix panic on table array behind a pointer by @pelletier in https://github.com/pelletier/go-toml/pull/682
    • Decoder: flag bad \r in literal multiline strings by @pelletier in https://github.com/pelletier/go-toml/pull/687
    • Decoder: check timezones start with +,-,z,Z by @pelletier in https://github.com/pelletier/go-toml/pull/688
    • Decoder: check tz has : between hours and minutes by @pelletier in https://github.com/pelletier/go-toml/pull/691
    • Decoder: check for invalid characters in timezone by @pelletier in https://github.com/pelletier/go-toml/pull/695
    • Decode: restrict timezone offset values by @moorereason in https://github.com/pelletier/go-toml/pull/696
    • Decode: ensure signed numbers don't start with an underscore by @moorereason in https://github.com/pelletier/go-toml/pull/698
    • Decode: allow maximum seconds value of 60 by @moorereason in https://github.com/pelletier/go-toml/pull/700
    • Decode: ensure signed exponents don't start with an underscore by @moorereason in https://github.com/pelletier/go-toml/pull/699
    • Decoder: prevent modification of inline tables by @pelletier in https://github.com/pelletier/go-toml/pull/702
    • Decoder: disallow modification of existing table by @pelletier in https://github.com/pelletier/go-toml/pull/704
    • Decode: fix maximum time offset values by @moorereason in https://github.com/pelletier/go-toml/pull/706
    • Decode: allow CRLF as whitespace before line ending backslash by @pelletier in https://github.com/pelletier/go-toml/pull/709
    • Decode: fix index panic on integers with just a sign by @moorereason in https://github.com/pelletier/go-toml/pull/716
    • Decode: check buffer length before parsing simple key by @moorereason in https://github.com/pelletier/go-toml/pull/717

    Documentation

    • Encoder: mention "-" to prevent encoding field in doc by @pelletier in https://github.com/pelletier/go-toml/pull/683
    • Readme: document more differences with v1 by @pelletier in https://github.com/pelletier/go-toml/pull/712
    • Doc: clarify errors returned by Decode by @pelletier in https://github.com/pelletier/go-toml/pull/713

    Full Changelog: https://github.com/pelletier/go-toml/compare/v2.0.0-beta.4...v2.0.0-beta.5

    Source code(tar.gz)
    Source code(zip)
  • v2.0.0-beta.4(Oct 28, 2021)

    Almost 5 months after the previous v2.0.0-beta.3 release, this beta version contains a lot of bug fixes, effectively closing all the known issues on v2 so far. It creates a solid foundation on the way to the stable release. Thank you to everybody involved!

    What's Changed

    What's new

    • Provide own implementation of Local* by @pelletier in https://github.com/pelletier/go-toml/pull/558
    • Decode: convert ints if target type is compatible by @pelletier in https://github.com/pelletier/go-toml/pull/594
    • Decode: support lowercase 'T' and 'Z' in date-time parsing by @moorereason in https://github.com/pelletier/go-toml/pull/601
    • Decode: preserve nanosecond precision when decoding time by @moorereason in https://github.com/pelletier/go-toml/pull/626

    Performance

    • Optimize hexadecimal decoding by @kkHAIKE in https://github.com/pelletier/go-toml/pull/568

    Fixed bugs

    • Decode: don't panic on recursive structs by @pelletier in https://github.com/pelletier/go-toml/pull/557
    • Decode: handle LocalTime to interface{} unmarshal by @kkHAIKE in https://github.com/pelletier/go-toml/pull/567
    • Decode: make copy of non addressable values by @pelletier in https://github.com/pelletier/go-toml/pull/576
    • Decode: don't crash on unterminated table key by @pelletier in https://github.com/pelletier/go-toml/pull/580
    • Decode: fix non-terminated array error by @pelletier in https://github.com/pelletier/go-toml/pull/584
    • Decode: don't crash on unterminated inline table by @pelletier in https://github.com/pelletier/go-toml/pull/587
    • Decode: fix error reporting for last comments by @pelletier in https://github.com/pelletier/go-toml/pull/591
    • Decode: don't overflow when parsing bad times by @pelletier in https://github.com/pelletier/go-toml/pull/593
    • Decode: don't panic when date time is missing timezone by @RiyaJohn in https://github.com/pelletier/go-toml/pull/614
    • Decode: fail when array is missing separator by @jidicula in https://github.com/pelletier/go-toml/pull/616
    • Encode: make floats always contain a decimal point by @zostay in https://github.com/pelletier/go-toml/pull/615
    • Decode: validate UTF-8 by @pelletier in https://github.com/pelletier/go-toml/pull/629
    • Decode: validate dates by @jidicula in https://github.com/pelletier/go-toml/pull/622
    • Encode: Follow RFC3339 spec for LocalTime by @jidicula in https://github.com/pelletier/go-toml/pull/632
    • Decode: handle more cases when during float validation by @pelletier in https://github.com/pelletier/go-toml/pull/636
    • Decode: Floats and integers parsing fixes by @pelletier in https://github.com/pelletier/go-toml/pull/638
    • Decode: check for explicit tables on dotted keys by @pelletier in https://github.com/pelletier/go-toml/pull/639
    • Decode: empty document should result in a map by @pelletier in https://github.com/pelletier/go-toml/pull/640
    • Decode: don't panic when storing table in slice by @pelletier in https://github.com/pelletier/go-toml/pull/641
    • Decode: use UnmarshalText for any type not just structs by @pelletier in https://github.com/pelletier/go-toml/pull/642
    • Decode: properly handle multiline strings termination by @pelletier in https://github.com/pelletier/go-toml/pull/643

    Documentation

    • Add installation instructions by @pelletier in https://github.com/pelletier/go-toml/pull/572
    • Update benchmarks results by @pelletier in https://github.com/pelletier/go-toml/pull/630

    Other changes

    • Go 1.17 release by @pelletier in https://github.com/pelletier/go-toml/pull/574

    New Contributors

    • @mmorel-35 made their first contribution in https://github.com/pelletier/go-toml/pull/570
    • @kkHAIKE made their first contribution in https://github.com/pelletier/go-toml/pull/568
    • @zostay made their first contribution in https://github.com/pelletier/go-toml/pull/615

    Full Changelog: https://github.com/pelletier/go-toml/compare/v2.0.0-beta.3...v2.0.0-beta.4

    Source code(tar.gz)
    Source code(zip)
  • v1.9.4(Sep 6, 2021)

    Changes:

    • b8ba995eaaba4be30c8a8090bdfb4aa61af52054 tomll: add multiLineArray flag to linter (#578)

    Checksums

    (sha256)

    736127ffcf3492efa2f105d2d4be9ce0308c9cdfb4e5091173dc86ae5139fdfd *jsontoml_darwin_amd64.tar.xz
    1bffb4ebe0a2ec62dd42e0aac983322f8233c0c80282a0a207ddc882b8165a94 *jsontoml_linux_amd64.tar.xz
    2b0a2976e085e492b4f117a59a63c97bca8ffcf21560799862f796dbbd5070ea *jsontoml_windows_amd64.tar.xz
    01005a47cd578428ab20a7f4180e785a22f718919b5b74acf26c9c388156d89f *tomljson_darwin_amd64.tar.xz
    85076f66a99c8ca9af1dc4a7a6e9403c410e2d382628112f098a151a265ecf69 *tomljson_linux_amd64.tar.xz
    e35ae9c4531ec395092b150bf1e9b7c2c5807b0090c596057db27aa890b05225 *tomljson_windows_amd64.tar.xz
    8616c17decc105e3b1824e88c4bd94e36c3be4a62a8be28028f21e6c9a82ce97 *tomll_darwin_amd64.tar.xz
    216ab1611d22913867eed216c8c0e571938f5ac930aa0ff2ab5ecfdd4290a945 *tomll_linux_amd64.tar.xz
    e5f8cca5dc801d3ead054acb5f81cb91953bc89b4793a0a9d9ef8f7aacce59d3 *tomll_windows_amd64.tar.xz
    
    Source code(tar.gz)
    Source code(zip)
    jsontoml_darwin_amd64.tar.xz(1.26 MB)
    jsontoml_linux_amd64.tar.xz(1.27 MB)
    jsontoml_windows_amd64.tar.xz(1.32 MB)
    sha256sums.txt(846 bytes)
    tomljson_darwin_amd64.tar.xz(1.28 MB)
    tomljson_linux_amd64.tar.xz(1.29 MB)
    tomljson_windows_amd64.tar.xz(1.34 MB)
    tomll_darwin_amd64.tar.xz(1.24 MB)
    tomll_linux_amd64.tar.xz(1.25 MB)
    tomll_windows_amd64.tar.xz(1.30 MB)
  • v1.9.3(Jun 14, 2021)

    Changes:

    • 837c1d09eef55dcf41167b80d9403f1fd2747105 Clarify license and comply with Apache 2.0 (#554)

    Checksums

    (sha256)

    27fd76c540501b1e223ecf934d2202ee88d329c0a79318ffebcdbc592d0dce9e *jsontoml_darwin_amd64.tar.xz
    6cf6590bfa72f2c5f026d4dfb29fdfa1986d02aa23f36589a5a0f7868e71e0bf *jsontoml_linux_amd64.tar.xz
    90e279ced95ed79edd79f933aa8c4f02bfc2762216d9e52e76becff71ab1202d *jsontoml_windows_amd64.tar.xz
    122b4ed91a6813f82a1afcf853f80ca53e3427007e9dbb943cbd806d5e4b34c8 *tomljson_darwin_amd64.tar.xz
    8eb3dda6198f5f2868098a4f74c1341e63b217e70938e5528bb82a376a0c798c *tomljson_linux_amd64.tar.xz
    f05d274070cc4f0d7563521a7e0d1874729bc0c7fa94474c49d9228ad7d6adb0 *tomljson_windows_amd64.tar.xz
    a824d7b3fafa61b183e99c434c908b09e42ce6b8c54a1347afec143ccecc9db8 *tomll_darwin_amd64.tar.xz
    1ff1b2e0fd057bdd86cd1b203c3b7c158fc3c196b59f2a0bfeee3d65f3ba95d6 *tomll_linux_amd64.tar.xz
    be9541829660470139bdb7244b9b0ff0c99aca1bf62465f32f115820cb586155 *tomll_windows_amd64.tar.xz
    
    Source code(tar.gz)
    Source code(zip)
    jsontoml_darwin_amd64.tar.xz(1.26 MB)
    jsontoml_linux_amd64.tar.xz(1.27 MB)
    jsontoml_windows_amd64.tar.xz(1.32 MB)
    sha256sums.txt(846 bytes)
    tomljson_darwin_amd64.tar.xz(1.28 MB)
    tomljson_linux_amd64.tar.xz(1.29 MB)
    tomljson_windows_amd64.tar.xz(1.34 MB)
    tomll_darwin_amd64.tar.xz(1.20 MB)
    tomll_linux_amd64.tar.xz(1.21 MB)
    tomll_windows_amd64.tar.xz(1.26 MB)
  • v2.0.0-beta.3(Jun 4, 2021)

    Work on performance improvement.

    Execution time speedup compared to other Go TOML libraries:

    Benchmarkgo-toml v1BurntSushi/toml
    Marshal/HugoFrontMatter2.0x2.0x
    Marshal/ReferenceFile/map1.8x2.0x
    Marshal/ReferenceFile/struct2.7x2.7x
    Unmarshal/HugoFrontMatter3.0x2.6x
    Unmarshal/ReferenceFile/map3.0x3.1x
    Unmarshal/ReferenceFile/struct5.9x6.6x
    See more

    The table above has the results of the most common use-cases. The table below contains the results of all benchmarks, including unrealistic ones. It is provided for completeness.

    Benchmarkgo-toml v1BurntSushi/toml
    Marshal/SimpleDocument/map1.7x2.1x
    Marshal/SimpleDocument/struct2.6x2.9x
    Unmarshal/SimpleDocument/map4.1x2.9x
    Unmarshal/SimpleDocument/struct6.3x4.1x
    UnmarshalDataset/example3.5x2.4x
    UnmarshalDataset/code2.2x2.8x
    UnmarshalDataset/twitter2.8x2.1x
    UnmarshalDataset/citm_catalog2.3x1.5x
    UnmarshalDataset/config4.2x3.2x
    [Geo mean]3.0x2.7x

    This table can be generated with ./ci.sh benchmark -a -html.

    Source code(tar.gz)
    Source code(zip)
  • v1.9.2(Jun 5, 2021)

    Changes:

    • d08347058532c70f4c6b6821bf8d3662d3f19bbf Add Encoder.CompactComments to omit extra new line (#541)

    Checksums

    (sha256)

    05d3657a7751ef00957e1c6f225514d32965a781e4d75b9d216a62582c00a90a *jsontoml_darwin_amd64.tar.xz
    981e9ebe23fd17008646283e2be806c16c02c55098526c9646e34a2b47138a49 *jsontoml_linux_amd64.tar.xz
    c2a30efc65aed2c3ca77eef4c1670fd506dc45016908a7703ea6ae604aefa786 *jsontoml_windows_amd64.tar.xz
    da6d15f947d6f73b27c809a7ad4aed24d71618e1524d2378726af1f67963939d *tomljson_darwin_amd64.tar.xz
    681ee708616632356a6793a719b72b908808014729c31e04b12d6cdc56064531 *tomljson_linux_amd64.tar.xz
    bce5d828b23aad9edc7b95a2b0d41ab95758406048eff3495969478a94bab206 *tomljson_windows_amd64.tar.xz
    6404a1fab65ddb02c13ec31aac743de9f8ebde452d23e18af68b0244a3f46912 *tomll_darwin_amd64.tar.xz
    5149b82d415fd5bc30c5f4ffc84af51d30b722fdf0d5fec27c76253801318959 *tomll_linux_amd64.tar.xz
    2cb87e431404e57a26bf21f46bd5743a079d4537dab0e2430b3e17a34d4adb85 *tomll_windows_amd64.tar.xz
    
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0-beta.2(May 11, 2021)

  • v1.9.1(May 11, 2021)

    Changes:

    • c893dbf25c73fac5239481e56c68239ded430fba Fix empty trees line counting (#539) [ #450 ]

    Checksums

    (sha256)

    174ecebbeb95d0b8044933553bbf6326e01258954cfd2771a51884618ae31755 *jsontoml_darwin_amd64.tar.xz
    f28f2155d3e1dab449c7ce05b5a1becf45c1132542d8c23d779b4e835b6d65a9 *jsontoml_linux_amd64.tar.xz
    fcb5bb97bd427d9f7d6f962f77ade4ae7f8001ce853b0b5dc585ca667529d9cb *jsontoml_windows_amd64.tar.xz
    54f3e6ed616ca1de8e160581dc62d0dbc1b9520d7027f68419e9f01d1cab0618 *tomljson_darwin_amd64.tar.xz
    af3cad39b40a4d47cb2fb08175d3bb5986d54410837470534d7088c498a763df *tomljson_linux_amd64.tar.xz
    77e335c951ce46734fb500488d0d9dd3697a1d3f62529733c8c4d0dc85f0aba5 *tomljson_windows_amd64.tar.xz
    f9e35cd578d8c497d34c6708ca680c39d3550117f16a68b961c995758c6fb505 *tomll_darwin_amd64.tar.xz
    c208f10b6ff0a9ade1f97c291c2cf86c0308e5d37bb16cf27879bead7cedb349 *tomll_linux_amd64.tar.xz
    0e0f961ef0c5866f2852158f05ae01975b46051e24c62490075e02fc1cb09338 *tomll_windows_amd64.tar.xz
    
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0-beta.1(May 8, 2021)

  • v2.0.0-alpha.2(Apr 21, 2021)

  • v2.0.0-alpha.1(Apr 15, 2021)

  • v1.9.0(Apr 5, 2021)

    The highlight of this version is that the whole toml.Tree structure has been made public in a backward compatible way. This allows everyone using v1.x to fully access the data and metadata in the tree to extend the library.

    This is hopefully the last release in the v1.x track, as go-toml v2 is the main focus of development.

    What's new

    • b4905040a87f311b2e1aa4ea8a382fd5e6c4def7 TOML 1.0.0-rc.3 (#449)
    • a713a3ecccb182949b44c7b8c574928212fad6d0 Improved default tag for durations (#464)
    • c9a09d8695a83a55cd171d147b09fdf10270e503 Provide Tree and treeValue public aliases (#467) [ #466 ]
    • ef48fb2be1f74d1ba19ca69b2e70b5e50ec7a244 Expose MarshalOrder (#470) [ #459, #469 ]
    • b4f0a950bf958ac1ed122b4bd45fdfb2c90c2957 Value string representation public function (#469) [ #468 ]

    Fixed bugs

    • f9ba08244db487b8b55172f1d03c88daedfc7db9 Do not allow T-prefix on local dates (#446) [ #442 ]
    • e6908614ee78e01b71b0adadb1379acff6da9320 toml.Unmarshaler supports leaf nodes (#444) [ #437 ]
    • a7448fe8de5c2e3d39f7b8f0507d252799b5221c Fix date lexer to only support 4-digit year (#443) [ #441 ]
    • 1bd9461acbccdf10268f9740405857b2550557ee Fix ToMap for tables in mixed-type arrays (#453)
    • ba1b12be14a2b53e25b6e9111cd1285ceb783eeb Fix ToMap for tables in nested mixed-type arrays (#461)
    • ce6fbd7bc088f354cd4ff3ed482fb36c956ff210 Support literal multiline marshal (#485)

    Performance

    • 5c66c78bc578ce3d4a07c91769e87c15fd545c34 Remove date regexp (#447)
    • 5b4e7e5dcc567bbc53b25ad81e06493ede66d301 Remove underscore regexps (#448) [ #440 ]

    Checksums

    (sha256)

    a48e25a93c68110c408fed73dd88656fd02f92c13682d6bc8d0ac90ab050b55f *jsontoml_darwin_amd64.tar.xz
    67128ecaa3eb4686c5fcde3c6d7e9c3dcbdafb6d80d18450f6518160d692f028 *jsontoml_linux_amd64.tar.xz
    315fc945fb0c0800ef845d565e58d62df442cdac4246447e257a3e8de1a376ed *jsontoml_windows_amd64.tar.xz
    31deb23a5aa7a582dd6552f71001a3db76bc55674fd422a5aa582275753f0eeb *tomljson_darwin_amd64.tar.xz
    3572908e07ece5b031fc16adc5072d6f3fc1b4ba3aecd4c17ede6c3dfbd03c2c *tomljson_linux_amd64.tar.xz
    fd9d8743262a80b20971061c914c0717e17a6d71b25f3dd9b7ee09f008f32e11 *tomljson_windows_amd64.tar.xz
    f551e27e3cb3400d45faccf602b65ad47531eb5f44dc8b335a87cbfb7df9b222 *tomll_darwin_amd64.tar.xz
    f39248f69fe4f41aa7df232cecf203e66735ac58ceb6272ed7fba4d8073af2f5 *tomll_linux_amd64.tar.xz
    55f0788eb81b8d869ad44896dc2007bb1ec49fd997a57e3125b6322b5d32dcc4 *tomll_windows_amd64.tar.xz
    
    Source code(tar.gz)
    Source code(zip)
  • v1.8.1(Sep 12, 2020)

    What's new

    • 661484ae7ee49a53c5ffa7a89e08920086427357 Add *Tree.SetPositionPath (#426)
    • 06838de5d2bce0102b4850889c7135e4a84a4e7c Add GetArray and GetArrayPath (#377)

    Fixed bugs

    • 65ca8064882c8c308e5c804c5d5443d409e0738c Fix Unmarshaler call when value is missing (#439) [ #431 ]
    • b76eb6211757490046121712dc5c7b10d5f8fec9 Allow marshal into empty interface{} (#433) [ #432 ]
    • 196ce3a1f601d3f3de7c3cb4686ad3d6398d6c02 Support go 1.15 (#434) [ #428 ]
    • 9f8f82dfe8a0a0f37c197778cc8f794af44ed3e2 Fix index exception when setting empty Tree slice (#425)
    • 34de94e6a887dcd421ab7586d76d26ee5ab3d96a Fix field overriding part of anonymous struct in order preserving mode [#421]
    • 1dbe20e76c929c3ed2f9e9a7a6b1d7ab9e67f74f Fix TreeFromMap on list of interfaces (#416) [ #415 ]
    • 05bf3807d36905c612e6008563dbe372a0c85f4c The return value of Marshal is used as a TOML value not a raw TOML formatted value [#414]

    Performance

    • 5c94d8602907f9f76fed2bf0130059f9518c4f01 Use strings.Builder in lexer (#438)

    Checksums

    (sha256)

    1d30d9f7f97ffaf5e5c802affaba25f4a5bf04346b753318acfc589d774d5488 *jsontoml_darwin_amd64.tar.xz
    2bb5d8a7470476c5b9bbb02b2e0f1a987ff7f9aac67bda0de1f7a5a0d38cb0ce *jsontoml_linux_amd64.tar.xz
    91cb1f7eebf0acade44475db39a75a6822a3121fe526357a238f5f2af5f19428 *jsontoml_windows_amd64.tar.xz
    65e5c4db86fe6a208d3f5db39db7c820174625bba0e6c0c2f1485f3df91acb7a *tomljson_darwin_amd64.tar.xz
    dc896369a05574b9aafade26b9d1d3ca66061b4999b4745875f273559e690587 *tomljson_linux_amd64.tar.xz
    5b6520e4c2fb80f90dafb8c710ff17833b0eb2354977b9016ef78e2c60176837 *tomljson_windows_amd64.tar.xz
    749ffffe8abb1dd96763da11065ebecbb0fdb023f7866ef5309e54f644413a61 *tomll_darwin_amd64.tar.xz
    8257cef2c0ea8bc5d6a6f3ee57ebf349b5f317f28164f061979ec2dade412ac3 *tomll_linux_amd64.tar.xz
    b97e882a5294049d1354e609e840061e4ae76a9a1b541ef7f2104619c7e7f0ac *tomll_windows_amd64.tar.xz
    
    Source code(tar.gz)
    Source code(zip)
    jsontoml_darwin_amd64.tar.xz(1.47 MB)
    jsontoml_linux_amd64.tar.xz(1.47 MB)
    jsontoml_windows_amd64.tar.xz(1.51 MB)
    sha256sums.txt(846 bytes)
    tomljson_darwin_amd64.tar.xz(1.51 MB)
    tomljson_linux_amd64.tar.xz(1.52 MB)
    tomljson_windows_amd64.tar.xz(1.56 MB)
    tomll_darwin_amd64.tar.xz(1.43 MB)
    tomll_linux_amd64.tar.xz(1.44 MB)
    tomll_windows_amd64.tar.xz(1.47 MB)
  • v1.8.0(May 17, 2020)

    What's new

    • 16c9a8bdc086a2130a88eff98df4088e4c359bb2 Support TOML v1.0.0-rc.1
    • 9ba73635523ca4df5059d161148a7ad7cf298b74 Allow spaces when using dotted keys in assignment (#402) [ #401 ]
    • c5fbd3eba6e6c46347061f2be5005a458a346b23 Add support of mixed-type array (#376) [ #357 ]
    • e7d1a179aeaaa957dbb931060557b5beb4297920 Support custom unmarshaler (#394)
    • 34782191ba114bbcdd0aeca621dbd303c048044e Add more supported default values types for unmarshaling (#392) [ #391 ]
    • 82a6a1977d0361be1013756fae1c0a687eec4fd4 Add indentation setting for Encoder (#386) [ #371 ]
    • d05497900e23ad60ab59518537c33e6af3656f0e Forbid adding keys to exist inline table (#378)
    • e29a498ed5b47ea382244b8f6c2caf5a14821481 unmarshal: support encoding.TextUnmarshaler (#375)
    • 2b8e33f5039358ee5baf28ccd55ba059f4989d7b marshal: support encoding.TextMarshaler (#374) [ #373 ]
    • d3c92c5999876ef37f03850546c93238a7841d5f unmarshal: add strict mode (#372) [ #277 ]
    • 323fe5d06373db38a4aa9d0c57885c4d68856744 fix #356 Unmarshal support []string ,[]int ... (#361)

    Fixed bugs

    • a60e466129af3efb3277a46ec01bab50f89a7f4e Fix index and slice expressions for query (#405)
    • 1479e1066396e0bdf2a345d019ed78baeaf9f943 Fix regression in default value handling (#406)
    • 96ff4029344dce1bd0d3a320395374eaa46ebb9d Fix marshaling nested arrays of tables (#395) [ #369 ]
    • 19eb8cf036efc1af977cc37c8b591211bc500d53 Fix various quoted keys bugs (#400) [ #396, #397, #398, #399 ]
    • 9ccd9bbc7ab0c4282e338a9a71c85b4bd4cba2b1 Fix unmarshaler error when a custom marshaler function is defined (#383) [ #382 ]
    • 71a8bd4c619876a9195e237ab6ea6b4b2a5d5467 Prevent automatic conversion between int and float when unmarshaling (#390) [ #389 ]
    • 7fbde32684d3e38fb59e5fbddae058471613738c Fix overflow checking when unmarshaling (#388) [ #387 ]
    • cc3100c329ba228d8161071d91c2382f87a0711a Fix unmarshaling arrays (#385) [ #384 ]
    • f1ba6388fb5981454e4f00b757bb2235bec1f327 Fix inline table loading errors (#381) [ #379, #380 ]
    • d1e0fc37ce141a2a968bde16e03f6d85f0cb9d14 marshal: do not encode embedded structs as sub-table (#368)
    • e9e8265313614e4d34fd9a9b0aa1c2e10625b615 Add support for tab in basic string value and quoted key (#364)
    • a30fd2239cbc5ee6413232b8a97e08bd1e0374da Escape adjacent quotation marks marshaling in multiline string (#365)
    • e872682c7887a7442c78554abdbfb4176867a008 Fix unmarshal error with tab in multi-line basic string (#355) [ #354 ]
    • 145b18309af4713241bff34afb9375abd1f2ed7f dont't panic when marshal from nil or unmarshal to nil interface or pointer (#353)

    Checksums

    (sha256)

    f7943604bfd11f0630c0720681899aa5c1ba23400fe0aee2eca79ce8edffcbd3 *jsontoml_darwin_amd64.tar.xz
    d471d0ca97c5b029beaa0eea1c233fb7e3016d2d9398bfd41df97c26d8e5f547 *jsontoml_linux_amd64.tar.xz
    6f320ebd2f9965713ee728f0543e2a773ad111ae2cd52e8475c52b5bb82d8980 *jsontoml_windows_amd64.tar.xz
    47d22db4f24b61159a318fcbf7f0d28e812cb484063ebcf3ad5a76f336b65706 *tomljson_darwin_amd64.tar.xz
    954d8c6ae63a82bcac85c9135409350699bda3a5dad42f2883c8f4efa8e3ff25 *tomljson_linux_amd64.tar.xz
    8833730a3d25881bfcbdcabddc992d617e55fbf2b129fe1687889cc3aa049b86 *tomljson_windows_amd64.tar.xz
    66c77476a2ecf1d945cb95e8fd2b4bec205db659348b5495e2e61d5b4ead01ec *tomll_darwin_amd64.tar.xz
    ada4a27c624db30267d60f9cf9733625ac79c114911994d00663739d99b99f46 *tomll_linux_amd64.tar.xz
    eb651e3adfd266ddbb28ad525a43f5d1e623d359060733549f45a1c8c415e3b1 *tomll_windows_amd64.tar.xz
    
    Source code(tar.gz)
    Source code(zip)
    jsontoml_darwin_amd64.tar.xz(1.48 MB)
    jsontoml_linux_amd64.tar.xz(1.48 MB)
    jsontoml_windows_amd64.tar.xz(1.51 MB)
    sha256sums.txt(846 bytes)
    tomljson_darwin_amd64.tar.xz(1.52 MB)
    tomljson_linux_amd64.tar.xz(1.53 MB)
    tomljson_windows_amd64.tar.xz(1.55 MB)
    tomll_darwin_amd64.tar.xz(1.44 MB)
    tomll_linux_amd64.tar.xz(1.44 MB)
    tomll_windows_amd64.tar.xz(1.46 MB)
  • v1.7.0(Apr 3, 2020)

    What's new

    • Support unmarshal into toml.Tree (#347) [ #333 ]
    • Binaries published with releases (#346) (#345)
    • Go 1.14 support (#343)
    • Add interface{} support to marshal and unmarshal (#341) (#335) [ #331 ]
    • Support default values for inner structs (#326)

    Fixed bugs

    • Fix unmarshaling of nested structs (#340) [ #339 ]
    • Fix multiline + non-primitive commenting (#336) [ #216 ]
    • Fix unexpected token type in inline table (#334) [ #321 ]

    Checksums

    (sha256)

    1a12132b3c577b2fabd5ddb1bca16c3d3b5ba175edfd89d4cb0a11f2255dead0 *jsontoml_darwin_amd64.tar.xz
    203f393f0e9f1a0a4b88f31f93b59907eeb44b8ebf023f730c1a72aadb401c7f *jsontoml_linux_amd64.tar.xz
    e88035ce374be8e9b0befd1cd343b05a4fe4557547e59b15b2fb0fc1056f0d5a *jsontoml_windows_amd64.tar.xz
    ff33de0e28b4ae9d17db7ae19bef37f83d5de8d3891eb3fd4476bc1319dcd6f7 *tomljson_darwin_amd64.tar.xz
    aed1e28e8917e32374613bad53fd97bd68a8d52bf99992b81d7e29302af3bbe0 *tomljson_linux_amd64.tar.xz
    62593f290f1fb0de045dc671d93f2b73d6adc939225452bdf1737c529d747bb8 *tomljson_windows_amd64.tar.xz
    8159d1f1a8a7fd8b98dfbd6911a89b8557b947f33b91083f487e4ba45612c61e *tomll_darwin_amd64.tar.xz
    cb5f2aa6196ace25c69aeec7a8ac9fd6a5ba846d54850b96bcc22617908d4837 *tomll_linux_amd64.tar.xz
    772fee3745e20efa6d0dd5fee05d20431c7839d31c5949f9c58011128798227f *tomll_windows_amd64.tar.xz
    
    Source code(tar.gz)
    Source code(zip)
    jsontoml_darwin_amd64.tar.xz(1.48 MB)
    jsontoml_linux_amd64.tar.xz(1.48 MB)
    jsontoml_windows_amd64.tar.xz(1.50 MB)
    sha256sums.txt(846 bytes)
    tomljson_darwin_amd64.tar.xz(1.52 MB)
    tomljson_linux_amd64.tar.xz(1.52 MB)
    tomljson_windows_amd64.tar.xz(1.55 MB)
    tomll_darwin_amd64.tar.xz(1.42 MB)
    tomll_linux_amd64.tar.xz(1.42 MB)
    tomll_windows_amd64.tar.xz(1.44 MB)
  • latest(Oct 18, 2021)

    Checksums

    (sha256)

    bf22eb7bf3565deae5eb7565bd6240624e333099d8ce85b62b7cdd4ff6b62cdb *jsontoml_darwin_amd64.tar.xz
    903c04e5138e104f98ffba1b803527c0a0860d0174357dbd1a1c74d42a001585 *jsontoml_linux_amd64.tar.xz
    e02e632849f007a7679f0af84a59d953bce5449a94a6451802f5cf2ed512edf1 *jsontoml_windows_amd64.tar.xz
    7925ff033f4ceeac994316021c8c73342fa363f2385876402b19f720f18222bc *tomljson_darwin_amd64.tar.xz
    df62c3a73597785bfdd0b27324670b4bfb37f9ffbeba55329810832a1217d600 *tomljson_linux_amd64.tar.xz
    f7a91ae1ca11ffa29c3661274cbd210c5ae8c99e5b89ff5a7fda703cabd24436 *tomljson_windows_amd64.tar.xz
    52cf5382c3fa64ae371956eb5b592b2153a17da1b77dda98c66994a0646d4fe1 *tomll_darwin_amd64.tar.xz
    dbdb05dddb6968a691a229770da6f6ada98f652b64e6c534ec13283614510789 *tomll_linux_amd64.tar.xz
    2dc9f21658fbe70b330c70c3d7b41a5894a9aa066354cbc7d5d073f7d3f070e2 *tomll_windows_amd64.tar.xz
    

    Changes:

    • 352072d51afc24d769bd644d0ee25b5f77749fa7 Create SECURITY.md
    • c42c3365f30b4819587b5aa0b77bcb064d08ec1f Support unmarshaling up to uint64 (#608)

    This list of changes was auto generated.

    Source code(tar.gz)
    Source code(zip)
    jsontoml_darwin_amd64.tar.xz(1.26 MB)
    jsontoml_linux_amd64.tar.xz(1.27 MB)
    jsontoml_windows_amd64.tar.xz(1.32 MB)
    sha256sums.txt(846 bytes)
    tomljson_darwin_amd64.tar.xz(1.28 MB)
    tomljson_linux_amd64.tar.xz(1.29 MB)
    tomljson_windows_amd64.tar.xz(1.34 MB)
    tomll_darwin_amd64.tar.xz(1.24 MB)
    tomll_linux_amd64.tar.xz(1.25 MB)
    tomll_windows_amd64.tar.xz(1.30 MB)
  • v1.6.0(Oct 25, 2019)

    What's new

    • TOML 0.5.0 support is complete!
    • Support marshaling arrays https://github.com/pelletier/go-toml/pull/310
    • Short date and local date, time, datetime support https://github.com/pelletier/go-toml/pull/298 https://github.com/pelletier/go-toml/pull/317 https://github.com/pelletier/go-toml/pull/318

    Fixed Bugs

    • Fix key parsing in inline tables https://github.com/pelletier/go-toml/pull/311

    All changes: https://github.com/pelletier/go-toml/compare/v1.5.0...v1.6.0

    Source code(tar.gz)
    Source code(zip)
  • v1.5.0(Oct 5, 2019)

    What's new

    • jsontoml tool https://github.com/pelletier/go-toml/pull/296
    • Allow space to separate date and time https://github.com/pelletier/go-toml/pull/300

    Fixed Bugs

    • Fix decoding of anonymous structs https://github.com/pelletier/go-toml/issues/279
    • Fix original values being overwritten when unmarshalling https://github.com/pelletier/go-toml/issues/283
    • Quote non-bare keys when encoding https://github.com/pelletier/go-toml/issues/290
    • Fix float64 truncation on marshalling https://github.com/pelletier/go-toml/pull/293
    • Fix Tree.Marshal() returning empty bytes without errors https://github.com/pelletier/go-toml/issues/295

    All changes: https://github.com/pelletier/go-toml/compare/v1.4.0...v1.5.0

    Source code(tar.gz)
    Source code(zip)
  • v1.4.0(May 2, 2019)

    What's new

    • Docker image for tools https://github.com/pelletier/go-toml/pull/269
    • Allow unmarshaling top level maps https://github.com/pelletier/go-toml/pull/273
    • Unmarshal handles custom key types convertible to string https://github.com/pelletier/go-toml/pull/276

    All changes: https://github.com/pelletier/go-toml/compare/v1.3.0...v1.4.0

    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Apr 2, 2019)

    What's new

    • Allow to change default tags for Decoder and Encoder https://github.com/pelletier/go-toml/pull/241
    • Support time.duration https://github.com/pelletier/go-toml/pull/248
    • Map camelCased keys to fields in structs https://github.com/pelletier/go-toml/pull/251
    • Allow to marshal pointer to struct and map https://github.com/pelletier/go-toml/pull/247
    • Support byte order mark https://github.com/pelletier/go-toml/issues/250
    • Add Delete* functions to Tree https://github.com/pelletier/go-toml/pull/256
    • Provide "default" tag for unmarshal https://github.com/pelletier/go-toml/pull/259
    • Go 1.12 support https://github.com/pelletier/go-toml/pull/261
    • Provide Go mod https://github.com/pelletier/go-toml/pull/265
    • Option to keep fields ordered when marshaling struct https://github.com/pelletier/go-toml/pull/266

    Fixed Bugs

    • Fix path not found message on Windows https://github.com/pelletier/go-toml/pull/227
    • Fix panic when type mismatch between toml and struct https://github.com/pelletier/go-toml/pull/236
    • Fix integer-only keys in inline tables https://github.com/pelletier/go-toml/issues/224

    All changes: https://github.com/pelletier/go-toml/compare/v1.2.0...v1.3.0

    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Jun 5, 2018)

    What's new

    • Go 1.10 support https://github.com/pelletier/go-toml/pull/223
    • Make multi-line arrays always use trailing commas https://github.com/pelletier/go-toml/pull/217
    • Multiline Marshal tag https://github.com/pelletier/go-toml/pull/221

    All changes: https://github.com/pelletier/go-toml/compare/v1.1.0...v1.2.0

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Jan 18, 2018)

    What's new

    • Comment annotation for Marshal https://github.com/pelletier/go-toml/pull/185
    • Support single-quoted keys https://github.com/pelletier/go-toml/pull/193
    • Add Encoder / Decoder capabilities https://github.com/pelletier/go-toml/pull/192
    • Encode can encode arrays on multiple lines https://github.com/pelletier/go-toml/pull/203
    • Support for hexadecimal, octal, and binary literals https://github.com/pelletier/go-toml/pull/205
    • Unmarshal into custom number types and check for overflows https://github.com/pelletier/go-toml/pull/209
    • Support for special float values (inf and nan) https://github.com/pelletier/go-toml/pull/210

    Fixed Bugs

    • Unmarshal should report a type mismatch as an error https://github.com/pelletier/go-toml/pull/196
    • Actually show the error message from an Error token https://github.com/pelletier/go-toml/pull/208

    All changes: https://github.com/pelletier/go-toml/compare/v1.0.1...v1.1.0

    Source code(tar.gz)
    Source code(zip)
  • v1.0.1(Oct 1, 2017)

    What's new

    • A few performance improvements. https://github.com/pelletier/go-toml/pull/170 https://github.com/pelletier/go-toml/pull/177 https://github.com/pelletier/go-toml/pull/176
    • Go 1.9 support. https://github.com/pelletier/go-toml/pull/179

    Fixed Bugs

    • Fix float to string encoding. https://github.com/pelletier/go-toml/pull/172
    • Fix example in the README. https://github.com/pelletier/go-toml/pull/187
    • Fix Marshal examples. https://github.com/pelletier/go-toml/pull/178

    All changes: https://github.com/pelletier/go-toml/compare/v1.0.0...v1.0.1

    Source code(tar.gz)
    Source code(zip)
Light weight, extensible configuration management library for Go. Built in support for JSON, TOML, YAML, env, command line, file, S3 etc. Alternative to viper.

koanf (pronounced conf; a play on the Japanese Koan) is a library for reading configuration from different sources in different formats in Go applicat

Kailash Nadh 1.1k Aug 8, 2022
TOML parser and encoder library for Golang

TOML parser and encoder library for Golang TOML parser and encoder library for Golang. This library is compatible with TOML version v0.4.0. Installati

Naoya Inada 288 Jul 10, 2022
TOML parser for Golang with reflection.

THIS PROJECT IS UNMAINTAINED The last commit to this repo before writing this message occurred over two years ago. While it was never my intention to

Andrew Gallant 3.9k Aug 6, 2022
Golang Configuration tool that support YAML, JSON, TOML, Shell Environment

Configor Golang Configuration tool that support YAML, JSON, TOML, Shell Environment (Supports Go 1.10+) Usage package main import ( "fmt" "github.c

Jinzhu 1.5k Aug 11, 2022
Generic templating tool with support of JSON, YAML and TOML data

gotempl Small binary used to generate files from Go Templates and data files. The following formats are supported: JSON YAML TOML Usage usage: gotempl

Link Society 7 Jun 15, 2022
Tmpl - A tool to apply variables from cli, env, JSON/TOML/YAML files to templates

tmpl allows to apply variables from JSON/TOML/YAML files, environment variables or CLI arguments to template files using Golang text/template and functions from the Sprig project.

krako 1 May 30, 2022
YAML support for the Go language.

YAML support for the Go language Introduction The yaml package enables Go programs to comfortably encode and decode YAML values. It was developed with

null 5.8k Aug 3, 2022
HCL is the HashiCorp configuration language.

HCL HCL is a toolkit for creating structured configuration languages that are both human- and machine-friendly, for use with command-line tools. Altho

HashiCorp 4.2k Aug 3, 2022
Tom's Obvious, Minimal Language

TOML Tom's Obvious, Minimal Language. By Tom Preston-Werner, Pradyun Gedam, et al. This repository contains the in-development version of the TOML spe

TOML 17.3k Aug 6, 2022
Graph-based Declarative Configuration Language

Virgo Configuration Language Most configuration problems reduce to graphs, e.g. Dockerfiles and Makefiles But there are no graph-based configuration l

Matt Rickard 112 Aug 3, 2022
YAML support for the Go language

YAML support for the Go language

Masaaki Goshima 733 Jul 29, 2022
Library for setting values to structs' fields from env, flags, files or default tag

Configuration is a library for injecting values recursively into structs - a convenient way of setting up a configuration object. Available features:

Bogdan Daragan 73 Jul 25, 2022
Small library to read your configuration from environment variables

envconfig envconfig is a library which allows you to parse your configuration from environment variables and fill an arbitrary struct. See the example

Vincent Rischmann 222 May 18, 2022
A minimalist Go configuration library

fig fig is a tiny library for loading an application's config file and its environment into a Go struct. Individual fields can have default values def

null 222 Jul 29, 2022
Genv is a library for Go (golang) that makes it easy to read and use environment variables in your projects. It also allows environment variables to be loaded from the .env file.

genv Genv is a library for Go (golang) that makes it easy to read and use environment variables in your projects. It also allows environment variables

Şakir Şensoy 28 Jul 9, 2022
go-up! A simple configuration library with recursive placeholders resolution and no magic.

go-up! A simple configuration library with placeholders resolution and no magic. go-up provides a simple way to configure an application from multiple

Francesco 37 Mar 23, 2022
A Go port of Ruby's dotenv library (Loads environment variables from `.env`.)

GoDotEnv A Go (golang) port of the Ruby dotenv project (which loads env vars from a .env file) From the original Library: Storing configuration in the

John Barton 5.2k Aug 10, 2022
go implementation of lightbend's HOCON configuration library https://github.com/lightbend/config

HOCON (Human-Optimized Config Object Notation) Configuration library for working with the Lightbend's HOCON format. HOCON is a human-friendly JSON sup

Gürkan Kaymak 45 Jul 6, 2022