Skip to content

deps: upgrade go-toml to v2.4.2#419

Open
GreyXor wants to merge 3 commits into
knadh:masterfrom
GreyXor:chore-upgrade-toml
Open

deps: upgrade go-toml to v2.4.2#419
GreyXor wants to merge 3 commits into
knadh:masterfrom
GreyXor:chore-upgrade-toml

Conversation

@knadh

knadh commented Jun 19, 2026

Copy link
Copy Markdown
Owner

hm, looks like there is a breaking change in how empty structures are treated in this version:

$ go test -v .
go: downloading github.com/pelletier/go-toml/v2 v2.4.0
=== RUN   TestTOML_Unmarshal
=== RUN   TestTOML_Unmarshal/Empty_TOML
    toml_test.go:73:
                Error Trace:    /home/kailash/code/go/my/knadh/koanf/parsers/toml/toml_test.go:73
                Error:          Not equal:
                                expected: map[string]interface {}(nil)
                                actual  : map[string]interface {}{}

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1,2 +1,3 @@
                                -(map[string]interface {}) <nil>
                                +(map[string]interface {}) {
                                +}

                Test:           TestTOML_Unmarshal/Empty_TOML
=== RUN   TestTOML_Unmarshal/Valid_TOML
=== RUN   TestTOML_Unmarshal/Invalid_TOML_-_missing_end_quotes
=== RUN   TestTOML_Unmarshal/Complex_TOML_-_All_types
=== RUN   TestTOML_Unmarshal/Invalid_TOML_-_missing_equal
--- FAIL: TestTOML_Unmarshal (0.00s)
    --- FAIL: TestTOML_Unmarshal/Empty_TOML (0.00s)
    --- PASS: TestTOML_Unmarshal/Valid_TOML (0.00s)
    --- PASS: TestTOML_Unmarshal/Invalid_TOML_-_missing_end_quotes (0.00s)
    --- PASS: TestTOML_Unmarshal/Complex_TOML_-_All_types (0.00s)
    --- PASS: TestTOML_Unmarshal/Invalid_TOML_-_missing_equal (0.00s)
=== RUN   TestTOML_Marshal
=== RUN   TestTOML_Marshal/Empty_TOML
    toml_test.go:135:
                Error Trace:    /home/kailash/code/go/my/knadh/koanf/parsers/toml/toml_test.go:135
                Error:          Not equal:
                                expected: []byte(nil)
                                actual  : []byte{}

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1,2 +1,3 @@
                                -([]uint8) <nil>
                                +([]uint8) {
                                +}

                Test:           TestTOML_Marshal/Empty_TOML
=== RUN   TestTOML_Marshal/Valid_TOML
=== RUN   TestTOML_Marshal/Complex_TOML_-_All_types
--- FAIL: TestTOML_Marshal (0.00s)
    --- FAIL: TestTOML_Marshal/Empty_TOML (0.00s)
    --- PASS: TestTOML_Marshal/Valid_TOML (0.00s)
    --- PASS: TestTOML_Marshal/Complex_TOML_-_All_types (0.00s)
FAIL
FAIL    github.com/knadh/koanf/parsers/toml/v2  0.003s
FAIL
@GreyXor

GreyXor commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

👍 thanks, I updated the two failing tests

@knadh

knadh commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Sorry, my point was that, between the two versions, the data type the toml lib returns has completely changed (breaking change). If we merge this as-is, it's bound to break koanf implementations out there that depend on the previous behaviour.

@GreyXor

GreyXor commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Sure @knadh, good catch indeed. I reverted the test and added a condition that preserve the old behavior. So the API is not silently altered anymore.

@GreyXor GreyXor changed the title deps: upgrade go-toml to v2.4.0 Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants