Browse code

migrate to github.com/pelletier/go-toml/v2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2026/02/03 06:46:17
Showing 3 changed files
... ...
@@ -5,7 +5,7 @@ import (
5 5
 	runcoptions "github.com/containerd/containerd/api/types/runc/options"
6 6
 	runtimeoptions "github.com/containerd/containerd/api/types/runtimeoptions/v1"
7 7
 	"github.com/containerd/containerd/v2/plugins"
8
-	"github.com/pelletier/go-toml"
8
+	"github.com/pelletier/go-toml/v2"
9 9
 )
10 10
 
11 11
 // Generate converts opts into a runtime options value for the runtimeType which
... ...
@@ -27,11 +27,11 @@ func Generate(runtimeType string, opts map[string]any) (any, error) {
27 27
 
28 28
 	// We can't use mergo.Map as it is too strict about type-assignability
29 29
 	// with numeric types.
30
-	tree, err := toml.TreeFromMap(opts)
30
+	b, err := toml.Marshal(opts)
31 31
 	if err != nil {
32 32
 		return nil, err
33 33
 	}
34
-	if err := tree.Unmarshal(out); err != nil {
34
+	if err := toml.Unmarshal(b, out); err != nil {
35 35
 		return nil, err
36 36
 	}
37 37
 	return out, nil
... ...
@@ -17,7 +17,7 @@ import (
17 17
 	"github.com/moby/buildkit/util/grpcerrors"
18 18
 	"github.com/moby/moby/v2/pkg/pidfile"
19 19
 	"github.com/moby/moby/v2/pkg/process"
20
-	"github.com/pelletier/go-toml"
20
+	"github.com/pelletier/go-toml/v2"
21 21
 	"github.com/pkg/errors"
22 22
 	"google.golang.org/grpc"
23 23
 	"google.golang.org/grpc/credentials/insecure"
... ...
@@ -86,7 +86,7 @@ require (
86 86
 	github.com/opencontainers/image-spec v1.1.1
87 87
 	github.com/opencontainers/runtime-spec v1.3.0
88 88
 	github.com/opencontainers/selinux v1.13.1
89
-	github.com/pelletier/go-toml v1.9.5
89
+	github.com/pelletier/go-toml/v2 v2.2.4
90 90
 	github.com/pkg/errors v0.9.1
91 91
 	github.com/prometheus/client_golang v1.23.2
92 92
 	github.com/rootless-containers/rootlesskit/v2 v2.3.6
... ...
@@ -234,7 +234,7 @@ require (
234 234
 	github.com/oklog/ulid v1.3.1 // indirect
235 235
 	github.com/opencontainers/runtime-tools v0.9.1-0.20251114084447-edf4cb3d2116 // indirect
236 236
 	github.com/package-url/packageurl-go v0.1.1 // indirect
237
-	github.com/pelletier/go-toml/v2 v2.2.4 // indirect
237
+	github.com/pelletier/go-toml v1.9.5 // indirect
238 238
 	github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect
239 239
 	github.com/philhofer/fwd v1.2.0 // indirect
240 240
 	github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect