chore: enable use-any rule from revive

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL
2025-08-08 16:01:30 +02:00
parent 5cb7e19528
commit 96f8c6395e
162 changed files with 573 additions and 564 deletions

View File

@@ -215,6 +215,7 @@ linters:
- name: superfluous-else
arguments:
- preserve-scope
- name: use-any
- name: use-errors-new
- name: var-declaration

View File

@@ -41,7 +41,7 @@ func TestContainerStart(t *testing.T) {
}
// we're not expecting any payload, but if one is supplied, check it is valid.
if req.Header.Get("Content-Type") == "application/json" {
var startConfig interface{}
var startConfig any
if err := json.NewDecoder(req.Body).Decode(&startConfig); err != nil {
return nil, fmt.Errorf("Unable to parse json: %s", err)
}

View File

@@ -14,7 +14,7 @@ import (
)
// postHijacked sends a POST request and hijacks the connection.
func (cli *Client) postHijacked(ctx context.Context, path string, query url.Values, body interface{}, headers map[string][]string) (HijackedResponse, error) {
func (cli *Client) postHijacked(ctx context.Context, path string, query url.Values, body any, headers map[string][]string) (HijackedResponse, error) {
jsonBody, err := jsonEncode(body)
if err != nil {
return HijackedResponse{}, err

View File

@@ -28,7 +28,7 @@ func (cli *Client) get(ctx context.Context, path string, query url.Values, heade
}
// post sends an http POST request to the API.
func (cli *Client) post(ctx context.Context, path string, query url.Values, body interface{}, headers http.Header) (*http.Response, error) {
func (cli *Client) post(ctx context.Context, path string, query url.Values, body any, headers http.Header) (*http.Response, error) {
jsonBody, headers, err := prepareJSONRequest(body, headers)
if err != nil {
return nil, err
@@ -40,7 +40,7 @@ func (cli *Client) postRaw(ctx context.Context, path string, query url.Values, b
return cli.sendRequest(ctx, http.MethodPost, path, query, body, headers)
}
func (cli *Client) put(ctx context.Context, path string, query url.Values, body interface{}, headers http.Header) (*http.Response, error) {
func (cli *Client) put(ctx context.Context, path string, query url.Values, body any, headers http.Header) (*http.Response, error) {
jsonBody, headers, err := prepareJSONRequest(body, headers)
if err != nil {
return nil, err
@@ -70,7 +70,7 @@ func (cli *Client) delete(ctx context.Context, path string, query url.Values, he
//
// TODO(thaJeztah): should this return an error if a different Content-Type is already set?
// TODO(thaJeztah): is "nil" the appropriate approach for an empty body, or should we use [http.NoBody] (or similar)?
func prepareJSONRequest(body interface{}, headers http.Header) (io.Reader, http.Header, error) {
func prepareJSONRequest(body any, headers http.Header) (io.Reader, http.Header, error) {
if body == nil {
return nil, headers, nil
}
@@ -309,7 +309,7 @@ func (cli *Client) addHeaders(req *http.Request, headers http.Header) *http.Requ
return req
}
func jsonEncode(data interface{}) (io.Reader, error) {
func jsonEncode(data any) (io.Reader, error) {
var params bytes.Buffer
if data != nil {
if err := json.NewEncoder(&params).Encode(data); err != nil {

View File

@@ -240,7 +240,7 @@ func processMetaArg(meta instructions.ArgCommand, shlex *shell.Lex, args *BuildA
return nil
}
func printCommand(out io.Writer, currentCommandIndex int, totalCommands int, cmd interface{}) int {
func printCommand(out io.Writer, currentCommandIndex int, totalCommands int, cmd any) int {
_, _ = fmt.Fprintf(out, stepFormat, currentCommandIndex, totalCommands, cmd)
_, _ = fmt.Fprintln(out)
return currentCommandIndex + 1

View File

@@ -32,8 +32,8 @@ import (
const unnamedFilename = "__unnamed__"
type pathCache interface {
Load(key interface{}) (value interface{}, ok bool)
Store(key, value interface{})
Load(key any) (value any, ok bool)
Store(key, value any)
}
// copyInfo is a data object which stores the metadata about each source file in

View File

@@ -50,7 +50,7 @@ type Backend interface {
Pull(ctx context.Context, ref reference.Named, name string, metaHeaders http.Header, authConfig *registry.AuthConfig, privileges plugintypes.Privileges, outStream io.Writer, opts ...plugin.CreateOpt) error
Upgrade(ctx context.Context, ref reference.Named, name string, metaHeaders http.Header, authConfig *registry.AuthConfig, privileges plugintypes.Privileges, outStream io.Writer) error
Get(name string) (*v2.Plugin, error)
SubscribeEvents(buffer int, events ...plugin.Event) (eventCh <-chan interface{}, cancel func())
SubscribeEvents(buffer int, events ...plugin.Event) (eventCh <-chan any, cancel func())
}
// NewController returns a new cluster plugin controller

View File

@@ -385,7 +385,7 @@ func (m *mockBackend) Get(name string) (*v2.Plugin, error) {
return m.p, nil
}
func (m *mockBackend) SubscribeEvents(buffer int, events ...plugin.Event) (eventCh <-chan interface{}, cancel func()) {
func (m *mockBackend) SubscribeEvents(buffer int, events ...plugin.Event) (eventCh <-chan any, cancel func()) {
ch := m.pub.SubscribeTopicWithBuffer(nil, buffer)
cancel = func() { m.pub.Evict(ch) }
return ch, cancel

View File

@@ -57,8 +57,8 @@ type Backend interface {
DaemonJoinsCluster(provider cluster.Provider)
DaemonLeavesCluster()
IsSwarmCompatible() error
SubscribeToEvents(since, until time.Time, filter filters.Args) ([]events.Message, chan interface{})
UnsubscribeFromEvents(listener chan interface{})
SubscribeToEvents(since, until time.Time, filter filters.Args) ([]events.Message, chan any)
UnsubscribeFromEvents(listener chan any)
UpdateAttachment(string, string, string, *network.NetworkingConfig) error
WaitForDetachment(context.Context, string, string, string, string) error
PluginManager() *plugin.Manager

View File

@@ -113,7 +113,7 @@ func (c *containerAdapter) pullImage(ctx context.Context) error {
dec := json.NewDecoder(pr)
dec.UseNumber()
m := map[string]interface{}{}
m := map[string]any{}
spamLimiter := rate.NewLimiter(rate.Every(time.Second), 1)
lastStatus := ""
@@ -128,7 +128,7 @@ func (c *containerAdapter) pullImage(ctx context.Context) error {
// limit pull progress logs unless the status changes
if spamLimiter.Allow() || lastStatus != m["status"] {
// if we have progress details, we have everything we need
if progress, ok := m["progressDetail"].(map[string]interface{}); ok {
if progress, ok := m["progressDetail"].(map[string]any); ok {
// first, log the image and status
l = l.WithFields(log.Fields{
"image": c.container.image(),

View File

@@ -257,7 +257,7 @@ type CommonConfig struct {
// FIXME(vdemeester) This part is not that clear and is mainly dependent on cli flags
// It should probably be handled outside this package.
ValuesSet map[string]interface{} `json:"-"`
ValuesSet map[string]any `json:"-"`
Experimental bool `json:"experimental"` // Experimental indicates whether experimental features should be exposed or not
@@ -512,7 +512,7 @@ func getConflictFreeConfiguration(configFile string, flags *pflag.FlagSet) (*Con
}
if flags != nil {
var jsonConfig map[string]interface{}
var jsonConfig map[string]any
if err := json.Unmarshal(b, &jsonConfig); err != nil {
return nil, err
}
@@ -528,7 +528,7 @@ func getConflictFreeConfiguration(configFile string, flags *pflag.FlagSet) (*Con
// See https://github.com/moby/moby/issues/20289 for an example.
//
// TODO: Rewrite configuration logic to avoid same issue with other nullable values, like numbers.
namedOptions := make(map[string]interface{})
namedOptions := make(map[string]any)
for key, value := range configSet {
f := flags.Lookup(key)
if f == nil { // ignore named flags that don't match
@@ -568,10 +568,10 @@ func getConflictFreeConfiguration(configFile string, flags *pflag.FlagSet) (*Con
}
// configValuesSet returns the configuration values explicitly set in the file.
func configValuesSet(config map[string]interface{}) map[string]interface{} {
flatten := make(map[string]interface{})
func configValuesSet(config map[string]any) map[string]any {
flatten := make(map[string]any)
for k, v := range config {
if m, isMap := v.(map[string]interface{}); isMap && !flatOptions[k] {
if m, isMap := v.(map[string]any); isMap && !flatOptions[k] {
for km, vm := range m {
flatten[km] = vm
}
@@ -586,9 +586,9 @@ func configValuesSet(config map[string]interface{}) map[string]interface{} {
// findConfigurationConflicts iterates over the provided flags searching for
// duplicated configurations and unknown keys. It returns an error with all the conflicts if
// it finds any.
func findConfigurationConflicts(config map[string]interface{}, flags *pflag.FlagSet) error {
func findConfigurationConflicts(config map[string]any, flags *pflag.FlagSet) error {
// 1. Search keys from the file that we don't recognize as flags.
unknownKeys := make(map[string]interface{})
unknownKeys := make(map[string]any)
for key, value := range config {
if flag := flags.Lookup(key); flag == nil && !skipValidateOptions[key] {
unknownKeys[key] = value
@@ -615,7 +615,7 @@ func findConfigurationConflicts(config map[string]interface{}, flags *pflag.Flag
}
// 3. Search keys that are present as a flag and as a file option.
printConflict := func(name string, flagValue, fileValue interface{}) string {
printConflict := func(name string, flagValue, fileValue any) string {
switch name {
case "http-proxy", "https-proxy":
flagValue = MaskCredentials(flagValue.(string))

View File

@@ -94,7 +94,7 @@ func TestDaemonConfigurationInvalidUnicode(t *testing.T) {
}
func TestFindConfigurationConflicts(t *testing.T) {
config := map[string]interface{}{"authorization-plugins": "foobar"}
config := map[string]any{"authorization-plugins": "foobar"}
flags := pflag.NewFlagSet("test", pflag.ContinueOnError)
flags.String("authorization-plugins", "", "")
@@ -103,7 +103,7 @@ func TestFindConfigurationConflicts(t *testing.T) {
}
func TestFindConfigurationConflictsWithNamedOptions(t *testing.T) {
config := map[string]interface{}{"hosts": []string{"qwer"}}
config := map[string]any{"hosts": []string{"qwer"}}
flags := pflag.NewFlagSet("test", pflag.ContinueOnError)
var hosts []string
@@ -195,7 +195,7 @@ func TestDaemonConfigurationMergeDefaultAddressPools(t *testing.T) {
}
func TestFindConfigurationConflictsWithUnknownKeys(t *testing.T) {
config := map[string]interface{}{"tls-verify": "true"}
config := map[string]any{"tls-verify": "true"}
flags := pflag.NewFlagSet("test", pflag.ContinueOnError)
flags.Bool("tlsverify", false, "")
@@ -205,7 +205,7 @@ func TestFindConfigurationConflictsWithUnknownKeys(t *testing.T) {
func TestFindConfigurationConflictsWithMergedValues(t *testing.T) {
var hosts []string
config := map[string]interface{}{"hosts": "tcp://127.0.0.1:2345"}
config := map[string]any{"hosts": "tcp://127.0.0.1:2345"}
flags := pflag.NewFlagSet("base", pflag.ContinueOnError)
flags.VarP(opts.NewNamedListOptsRef("hosts", &hosts, nil), "host", "H", "")

View File

@@ -199,7 +199,7 @@ func (daemon *Daemon) initializeNetworkingPaths(ctr *container.Container, nc *co
}
if data["GW_INFO"] != nil {
gwInfo := data["GW_INFO"].(map[string]interface{})
gwInfo := data["GW_INFO"].(map[string]any)
if gwInfo["hnsid"] != nil {
ctr.SharedEndpointList = append(ctr.SharedEndpointList, gwInfo["hnsid"].(string))
}

View File

@@ -343,7 +343,7 @@ func fillUncompressedLabel(ctx context.Context, cs content.Store, compressedDige
}
// storeJson marshals the provided object as json and stores it.
func storeJson(ctx context.Context, cs content.Ingester, mt string, obj interface{}, labels map[string]string) (ocispec.Descriptor, error) {
func storeJson(ctx context.Context, cs content.Ingester, mt string, obj any, labels map[string]string) (ocispec.Descriptor, error) {
configData, err := json.Marshal(obj)
if err != nil {
return ocispec.Descriptor{}, errdefs.InvalidParameter(err)

View File

@@ -732,7 +732,7 @@ func computeSharedSize(chainIDs []digest.Digest, layers map[digest.Digest]int, s
}
// readJSON reads content pointed by the descriptor and unmarshals it into a specified output.
func readJSON(ctx context.Context, store content.Provider, desc ocispec.Descriptor, out interface{}) error {
func readJSON(ctx context.Context, store content.Provider, desc ocispec.Descriptor, out any) error {
data, err := content.ReadBlob(ctx, store, desc)
if err != nil {
err = errors.Wrapf(err, "failed to read config content")

View File

@@ -232,7 +232,7 @@ func (im *ImageManifest) ImagePlatform(ctx context.Context) (ocispec.Platform, e
// ReadConfig gets the image config and unmarshals it into the provided struct.
// The provided struct should be a pointer to the config struct or its subset.
func (im *ImageManifest) ReadConfig(ctx context.Context, outConfig interface{}) error {
func (im *ImageManifest) ReadConfig(ctx context.Context, outConfig any) error {
configDesc, err := im.Config(ctx)
if err != nil {
return err

View File

@@ -12,7 +12,7 @@ func checkSystem() error {
return errors.New("the Docker daemon is not supported on this platform")
}
func setupResolvConf(_ *interface{}) {}
func setupResolvConf(_ *any) {}
func getSysInfo(_ *Daemon) *sysinfo.SysInfo {
return sysinfo.New()

View File

@@ -233,7 +233,7 @@ func configureMaxThreads(_ context.Context) error {
return nil
}
func (daemon *Daemon) initNetworkController(daemonCfg *config.Config, activeSandboxes map[string]interface{}) error {
func (daemon *Daemon) initNetworkController(daemonCfg *config.Config, activeSandboxes map[string]any) error {
netOptions, err := daemon.networkOptions(daemonCfg, nil, daemon.id, nil)
if err != nil {
return err

View File

@@ -79,13 +79,13 @@ func (daemon *Daemon) LogDaemonEventWithAttributes(action events.Action, attribu
}
// SubscribeToEvents returns the currently record of events, a channel to stream new events from, and a function to cancel the stream of events.
func (daemon *Daemon) SubscribeToEvents(since, until time.Time, filter filters.Args) ([]events.Message, chan interface{}) {
func (daemon *Daemon) SubscribeToEvents(since, until time.Time, filter filters.Args) ([]events.Message, chan any) {
return daemon.EventsService.SubscribeTopic(since, until, daemonevents.NewFilter(filter))
}
// UnsubscribeFromEvents stops the event subscription for a client by closing the
// channel where the daemon sends events to.
func (daemon *Daemon) UnsubscribeFromEvents(listener chan interface{}) {
func (daemon *Daemon) UnsubscribeFromEvents(listener chan any) {
daemon.EventsService.Evict(listener)
}

View File

@@ -33,7 +33,7 @@ func New() *Events {
// last events, a channel in which you can expect new events (in form
// of interface{}, so you need type assertion), and a function to call
// to stop the stream of events.
func (e *Events) Subscribe() ([]eventtypes.Message, chan interface{}, func()) {
func (e *Events) Subscribe() ([]eventtypes.Message, chan any, func()) {
metrics.EventSubscribers.Inc()
e.mu.Lock()
current := make([]eventtypes.Message, len(e.events))
@@ -50,18 +50,18 @@ func (e *Events) Subscribe() ([]eventtypes.Message, chan interface{}, func()) {
// SubscribeTopic adds new listener to events, returns slice of 256 stored
// last events, a channel in which you can expect new events (in form
// of interface{}, so you need type assertion).
func (e *Events) SubscribeTopic(since, until time.Time, ef *Filter) ([]eventtypes.Message, chan interface{}) {
func (e *Events) SubscribeTopic(since, until time.Time, ef *Filter) ([]eventtypes.Message, chan any) {
metrics.EventSubscribers.Inc()
e.mu.Lock()
var topic func(m interface{}) bool
var topic func(m any) bool
if ef != nil && ef.filter.Len() > 0 {
topic = func(m interface{}) bool { return ef.Include(m.(eventtypes.Message)) }
topic = func(m any) bool { return ef.Include(m.(eventtypes.Message)) }
}
buffered := e.loadBufferedEvents(since, until, topic)
var ch chan interface{}
var ch chan any
if topic != nil {
ch = e.pub.SubscribeTopic(topic)
} else {
@@ -74,7 +74,7 @@ func (e *Events) SubscribeTopic(since, until time.Time, ef *Filter) ([]eventtype
}
// Evict evicts listener from pubsub
func (e *Events) Evict(l chan interface{}) {
func (e *Events) Evict(l chan any) {
metrics.EventSubscribers.Dec()
e.pub.Evict(l)
}
@@ -133,7 +133,7 @@ func (e *Events) SubscribersCount() int {
// and returns those that were emitted between two specific dates.
// It uses `time.Unix(seconds, nanoseconds)` to generate valid dates with those arguments.
// It filters those buffered messages with a topic function if it's not nil, otherwise it adds all messages.
func (e *Events) loadBufferedEvents(since, until time.Time, topic func(interface{}) bool) []eventtypes.Message {
func (e *Events) loadBufferedEvents(since, until time.Time, topic func(any) bool) []eventtypes.Message {
var buffered []eventtypes.Message
if since.IsZero() && until.IsZero() {
return buffered

View File

@@ -70,7 +70,7 @@ func TestLogContainerEventWithAttributes(t *testing.T) {
})
}
func validateTestAttributes(t *testing.T, l chan interface{}, expectedAttributesToTest map[string]string) {
func validateTestAttributes(t *testing.T, l chan any, expectedAttributesToTest map[string]string) {
select {
case ev := <-l:
event, ok := ev.(eventtypes.Message)

View File

@@ -490,7 +490,7 @@ func (sp *streamProxy) Context() context.Context {
return sp.ctx
}
func (sp *streamProxy) RecvMsg(m interface{}) error {
func (sp *streamProxy) RecvMsg(m any) error {
return io.EOF
}
@@ -503,7 +503,7 @@ func (sp *statusProxy) Send(resp *controlapi.StatusResponse) error {
return sp.SendMsg(resp)
}
func (sp *statusProxy) SendMsg(m interface{}) error {
func (sp *statusProxy) SendMsg(m any) error {
if sr, ok := m.(*controlapi.StatusResponse); ok {
sp.ch <- sr
}
@@ -519,7 +519,7 @@ func (sp *pruneProxy) Send(resp *controlapi.UsageRecord) error {
return sp.SendMsg(resp)
}
func (sp *pruneProxy) SendMsg(m interface{}) error {
func (sp *pruneProxy) SendMsg(m any) error {
if sr, ok := m.(*controlapi.UsageRecord); ok {
sp.ch <- sr
}

View File

@@ -2,6 +2,14 @@
package buildkit
import (
"github.com/moby/buildkit/executor"
"github.com/moby/buildkit/executor/oci"
"github.com/moby/buildkit/solver/llbsolver/cdidevices"
"github.com/moby/moby/v2/daemon/libnetwork"
"github.com/moby/sys/user"
)
func newExecutor(_, _ string, _ *libnetwork.Controller, _ *oci.DNSConfig, _ bool, _ user.IdentityMapping, _ string, _ *cdidevices.Manager, _, _ string) (executor.Executor, error) {
return &stubExecutor{}, nil
}

View File

@@ -39,7 +39,7 @@ func CreateID(v1Image image.V1Image, layerID layer.ChainID, parent digest.Digest
return digest.FromBytes(configJSON), nil
}
func rawJSON(value interface{}) *json.RawMessage {
func rawJSON(value any) *json.RawMessage {
jsonval, err := json.Marshal(value)
if err != nil {
return nil

View File

@@ -145,7 +145,7 @@ func (c *client) Version(ctx context.Context) (containerd.Version, error) {
// "ImagePath": "C:\\\\control\\\\windowsfilter\\\\65bf96e5760a09edf1790cb229e2dfb2dbd0fcdc0bf7451bae099106bfbfea0c\\\\UtilityVM"
// },
// }
func (c *client) NewContainer(_ context.Context, id string, spec *specs.Spec, _ string, _ interface{}, _ ...containerd.NewContainerOpts) (libcontainerdtypes.Container, error) {
func (c *client) NewContainer(_ context.Context, id string, spec *specs.Spec, _ string, _ any, _ ...containerd.NewContainerOpts) (libcontainerdtypes.Container, error) {
if spec.Linux != nil {
return nil, errors.New("linux containers are not supported on this platform")
}

View File

@@ -118,7 +118,7 @@ func (c *container) AttachTask(ctx context.Context, attachStdio libcontainerdtyp
return c.newTask(t), nil
}
func (c *client) NewContainer(ctx context.Context, id string, ociSpec *specs.Spec, shim string, runtimeOptions interface{}, opts ...containerd.NewContainerOpts) (libcontainerdtypes.Container, error) {
func (c *client) NewContainer(ctx context.Context, id string, ociSpec *specs.Spec, shim string, runtimeOptions any, opts ...containerd.NewContainerOpts) (libcontainerdtypes.Container, error) {
bdir := c.bundleDir(id)
c.logger.WithField("bundle", bdir).WithField("root", ociSpec.Root.Path).Debug("bundle dir created")

View File

@@ -16,7 +16,7 @@ import (
"github.com/opencontainers/runtime-spec/specs-go"
)
func summaryFromInterface(i interface{}) (*libcontainerdtypes.Summary, error) {
func summaryFromInterface(i any) (*libcontainerdtypes.Summary, error) {
return &libcontainerdtypes.Summary{}, nil
}

View File

@@ -16,7 +16,7 @@ import (
"github.com/pkg/errors"
)
func summaryFromInterface(i interface{}) (*libcontainerdtypes.Summary, error) {
func summaryFromInterface(i any) (*libcontainerdtypes.Summary, error) {
switch pd := i.(type) {
case *options.ProcessDetails:
return &libcontainerdtypes.Summary{

View File

@@ -14,7 +14,7 @@ import (
// ReplaceContainer creates a new container, replacing any existing container
// with the same id if necessary.
func ReplaceContainer(ctx context.Context, client types.Client, id string, spec *specs.Spec, shim string, runtimeOptions interface{}, opts ...containerd.NewContainerOpts) (types.Container, error) {
func ReplaceContainer(ctx context.Context, client types.Client, id string, spec *specs.Spec, shim string, runtimeOptions any, opts ...containerd.NewContainerOpts) (types.Container, error) {
newContainer := func() (types.Container, error) {
return client.NewContainer(ctx, id, spec, shim, runtimeOptions, opts...)
}

View File

@@ -10,12 +10,12 @@ import (
// Generate converts opts into a runtime options value for the runtimeType which
// can be passed into containerd.
func Generate(runtimeType string, opts map[string]interface{}) (interface{}, error) {
func Generate(runtimeType string, opts map[string]any) (any, error) {
// This is horrible, but we have no other choice. The containerd client
// can only handle options values which can be marshaled into a
// typeurl.Any. And we're in good company: cri-containerd handles shim
// options in the same way.
var out interface{}
var out any
switch runtimeType {
case plugins.RuntimeRuncV2:
out = &runcoptions.Options{}

View File

@@ -59,7 +59,7 @@ type Client interface {
// LoadContainer loads the metadata for a container from containerd.
LoadContainer(ctx context.Context, containerID string) (Container, error)
// NewContainer creates a new containerd container.
NewContainer(ctx context.Context, containerID string, spec *specs.Spec, shim string, runtimeOptions interface{}, opts ...containerd.NewContainerOpts) (Container, error)
NewContainer(ctx context.Context, containerID string, spec *specs.Spec, shim string, runtimeOptions any, opts ...containerd.NewContainerOpts) (Container, error)
}
// Container provides access to a containerd container.

View File

@@ -15,11 +15,11 @@ type Stats struct {
// Metrics is expected to be either one of:
// * github.com/containerd/cgroups/v3/cgroup1/stats.Metrics
// * github.com/containerd/cgroups/v3/cgroup2/stats.Metrics
Metrics interface{}
Metrics any
}
// InterfaceToStats returns a stats object from the platform-specific interface.
func InterfaceToStats(read time.Time, v interface{}) *Stats {
func InterfaceToStats(read time.Time, v any) *Stats {
return &Stats{
Metrics: v,
Read: read,

View File

@@ -16,7 +16,7 @@ type Stats struct {
}
// InterfaceToStats returns a stats object from the platform-specific interface.
func InterfaceToStats(read time.Time, v interface{}) *Stats {
func InterfaceToStats(read time.Time, v any) *Stats {
return &Stats{
HCSStats: v.(*hcsshim.Statistics),
Read: read,

View File

@@ -24,7 +24,7 @@ type ExitHandler interface {
}
// New creates a new containerd plugin executor
func New(ctx context.Context, rootDir string, cli *containerd.Client, ns string, exitHandler ExitHandler, shim string, shimOpts interface{}) (*Executor, error) {
func New(ctx context.Context, rootDir string, cli *containerd.Client, ns string, exitHandler ExitHandler, shim string, shimOpts any) (*Executor, error) {
e := &Executor{
rootDir: rootDir,
exitHandler: exitHandler,
@@ -47,7 +47,7 @@ type Executor struct {
client libcontainerdtypes.Client
exitHandler ExitHandler
shim string
shimOpts interface{}
shimOpts any
mu sync.Mutex // Guards plugins map
plugins map[string]*c8dPlugin

View File

@@ -81,7 +81,7 @@ func validateCreateRequest(w container.CreateRequest, si *sysinfo.SysInfo) error
}
// loadJSON is similar to api/server/httputils.ReadJSON()
func loadJSON(src io.Reader, out interface{}) error {
func loadJSON(src io.Reader, out any) error {
dec := json.NewDecoder(src)
if err := dec.Decode(&out); err != nil {
// invalidJSONError allows unwrapping the error to detect io.EOF etc.

View File

@@ -180,7 +180,7 @@ func getBuffer(size int) *fixedBuffer {
bufPoolsLock.Lock()
pool, ok := bufPools[size]
if !ok {
pool = &sync.Pool{New: func() interface{} { return &fixedBuffer{buf: make([]byte, 0, size)} }}
pool = &sync.Pool{New: func() any { return &fixedBuffer{buf: make([]byte, 0, size)} }}
bufPools[size] = pool
}
bufPoolsLock.Unlock()

View File

@@ -28,7 +28,7 @@ func (d *manager) NetworkFree(id string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *manager) CreateNetwork(ctx context.Context, id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
func (d *manager) CreateNetwork(ctx context.Context, id string, option map[string]any, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
return types.NotImplementedErrorf("not implemented")
}
@@ -36,7 +36,7 @@ func (d *manager) DeleteNetwork(nid string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *manager) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
func (d *manager) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]any) error {
return types.NotImplementedErrorf("not implemented")
}
@@ -44,11 +44,11 @@ func (d *manager) DeleteEndpoint(nid, eid string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *manager) EndpointOperInfo(nid, eid string) (map[string]interface{}, error) {
func (d *manager) EndpointOperInfo(nid, eid string) (map[string]any, error) {
return nil, types.NotImplementedErrorf("not implemented")
}
func (d *manager) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, _ map[string]interface{}) error {
func (d *manager) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, _ map[string]any) error {
return types.NotImplementedErrorf("not implemented")
}

View File

@@ -383,12 +383,12 @@ func (c *Controller) agentStopComplete() {
c.mu.Unlock()
}
func (c *Controller) makeDriverConfig(ntype string) map[string]interface{} {
func (c *Controller) makeDriverConfig(ntype string) map[string]any {
if c.cfg == nil {
return nil
}
cfg := map[string]interface{}{}
cfg := map[string]any{}
for _, label := range c.cfg.Labels {
key, val, _ := strings.Cut(label, "=")
if !strings.HasPrefix(key, netlabel.DriverPrefix+"."+ntype) {
@@ -551,7 +551,7 @@ func (c *Controller) NewNetwork(ctx context.Context, networkType, name string, i
nw := &Network{
name: name,
networkType: networkType,
generic: map[string]interface{}{netlabel.GenericData: make(map[string]string)},
generic: map[string]any{netlabel.GenericData: make(map[string]string)},
ipamType: defaultIpam,
enableIPv4: true,
id: id,

View File

@@ -123,7 +123,7 @@ func (n *dummyObject) Skip() bool {
}
func (n *dummyObject) MarshalJSON() ([]byte, error) {
return json.Marshal(map[string]interface{}{
return json.Marshal(map[string]any{
"name": n.Name,
"networkType": n.NetworkType,
"enableIPv6": n.EnableIPv6,
@@ -132,14 +132,14 @@ func (n *dummyObject) MarshalJSON() ([]byte, error) {
}
func (n *dummyObject) UnmarshalJSON(b []byte) error {
var netMap map[string]interface{}
var netMap map[string]any
if err := json.Unmarshal(b, &netMap); err != nil {
return err
}
n.Name = netMap["name"].(string)
n.NetworkType = netMap["networkType"].(string)
n.EnableIPv6 = netMap["enableIPv6"].(bool)
n.Generic = netMap["generic"].(map[string]interface{})
n.Generic = netMap["generic"].(map[string]any)
return nil
}
@@ -213,7 +213,7 @@ func dummyKVObject(id string, retValue bool) *dummyObject {
ReturnValue: retValue,
DBExists: false,
SkipSave: false,
Generic: map[string]interface{}{
Generic: map[string]any{
"label1": &recStruct{Name: "value1", Field1: 1, Dict: cDict},
"label2": "subnet=10.1.1.0/16",
},

View File

@@ -4,10 +4,10 @@ package discoverapi
// like new node joining the cluster or datastore updates
type Discover interface {
// DiscoverNew is a notification for a new discovery event, Example:a new node joining a cluster
DiscoverNew(dType DiscoveryType, data interface{}) error
DiscoverNew(dType DiscoveryType, data any) error
// DiscoverDelete is a notification for a discovery delete event, Example:a node leaving a cluster
DiscoverDelete(dType DiscoveryType, data interface{}) error
DiscoverDelete(dType DiscoveryType, data any) error
}
// DiscoveryType represents the type of discovery element the DiscoverNew function is invoked on
@@ -36,7 +36,7 @@ type DatastoreConfigData struct {
Scope string
Provider string
Address string
Config interface{}
Config any
}
// DriverEncryptionConfig contains the initial datapath encryption key(s)

View File

@@ -31,7 +31,7 @@ type Driver interface {
// notification when a CRUD operation is performed on any
// entry in that table. This will be ignored for local scope
// drivers.
CreateNetwork(ctx context.Context, nid string, options map[string]interface{}, nInfo NetworkInfo, ipV4Data, ipV6Data []IPAMData) error
CreateNetwork(ctx context.Context, nid string, options map[string]any, nInfo NetworkInfo, ipV4Data, ipV6Data []IPAMData) error
// DeleteNetwork invokes the driver method to delete network passing
// the network id.
@@ -42,17 +42,17 @@ type Driver interface {
// specific config. The endpoint information can be either consumed by
// the driver or populated by the driver. The config mechanism will
// eventually be replaced with labels which are yet to be introduced.
CreateEndpoint(ctx context.Context, nid, eid string, ifInfo InterfaceInfo, options map[string]interface{}) error
CreateEndpoint(ctx context.Context, nid, eid string, ifInfo InterfaceInfo, options map[string]any) error
// DeleteEndpoint invokes the driver method to delete an endpoint
// passing the network id and endpoint id.
DeleteEndpoint(nid, eid string) error
// EndpointOperInfo retrieves from the driver the operational data related to the specified endpoint
EndpointOperInfo(nid, eid string) (map[string]interface{}, error)
EndpointOperInfo(nid, eid string) (map[string]any, error)
// Join method is invoked when a Sandbox is attached to an endpoint.
Join(ctx context.Context, nid, eid string, sboxKey string, jinfo JoinInfo, epOpts, sbOpts map[string]interface{}) error
Join(ctx context.Context, nid, eid string, sboxKey string, jinfo JoinInfo, epOpts, sbOpts map[string]any) error
// Leave method is invoked when a Sandbox detaches from an endpoint.
Leave(nid, eid string) error

View File

@@ -10,7 +10,7 @@ import (
// MarshalJSON encodes IPAMData into json message
func (i *IPAMData) MarshalJSON() ([]byte, error) {
m := map[string]interface{}{}
m := map[string]any{}
m["AddressSpace"] = i.AddressSpace
if i.Pool != nil {
m["Pool"] = i.Pool.String()
@@ -31,7 +31,7 @@ func (i *IPAMData) MarshalJSON() ([]byte, error) {
// UnmarshalJSON decodes a json message into IPAMData
func (i *IPAMData) UnmarshalJSON(data []byte) error {
var (
m map[string]interface{}
m map[string]any
err error
)
if err := json.Unmarshal(data, &m); err != nil {

View File

@@ -187,7 +187,7 @@ func newDriver(store *datastore.Store, pms *drvregistry.PortMappers) *driver {
}
// Register registers a new instance of bridge driver.
func Register(r driverapi.Registerer, store *datastore.Store, pms *drvregistry.PortMappers, config map[string]interface{}) error {
func Register(r driverapi.Registerer, store *datastore.Store, pms *drvregistry.PortMappers, config map[string]any) error {
d := newDriver(store, pms)
if err := d.configure(config); err != nil {
return err
@@ -504,7 +504,7 @@ func (n *bridgeNetwork) getEndpoint(eid string) (*bridgeEndpoint, error) {
return nil, nil
}
func (d *driver) configure(option map[string]interface{}) error {
func (d *driver) configure(option map[string]any) error {
var config configuration
switch opt := option[netlabel.GenericData].(type) {
case options.Generic:
@@ -581,7 +581,7 @@ func (d *driver) getNetwork(id string) (*bridgeNetwork, error) {
return nil, types.NotFoundErrorf("network not found: %s", id)
}
func parseNetworkGenericOptions(data interface{}) (*networkConfiguration, error) {
func parseNetworkGenericOptions(data any) (*networkConfiguration, error) {
var (
err error
config *networkConfiguration
@@ -721,7 +721,7 @@ func (d *driver) GetSkipGwAlloc(opts options.Generic) (ipv4, ipv6 bool, _ error)
}
// CreateNetwork creates a new network using the bridge driver.
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]any, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
// Sanity checks
d.mu.Lock()
if _, ok := d.networks[id]; ok {
@@ -1046,7 +1046,7 @@ func setHairpinMode(nlh nlwrap.Handle, link netlink.Link, enable bool) error {
return nil
}
func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, _ map[string]interface{}) error {
func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, _ map[string]any) error {
if ifInfo == nil {
return errors.New("invalid interface info passed")
}
@@ -1353,7 +1353,7 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
return nil
}
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, error) {
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]any, error) {
// Get the network handler and make sure it exists
d.mu.Lock()
n, ok := d.networks[nid]
@@ -1382,7 +1382,7 @@ func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, erro
return nil, driverapi.ErrNoEndpoint(eid)
}
m := make(map[string]interface{})
m := make(map[string]any)
if ep.extConnConfig != nil && ep.extConnConfig.ExposedPorts != nil {
// Return a copy of the config data
@@ -1410,7 +1410,7 @@ func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, erro
}
// Join method is invoked when a Sandbox is attached to an endpoint.
func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, epOpts, sbOpts map[string]interface{}) error {
func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, epOpts, sbOpts map[string]any) error {
ctx, span := otel.Tracer("").Start(ctx, spanPrefix+".Join", trace.WithAttributes(
attribute.String("nid", nid),
attribute.String("eid", eid),
@@ -1753,7 +1753,7 @@ func (d *driver) handleFirewalldReloadNw(nid string) {
}
}
func LegacyContainerLinkOptions(parentEndpoints, childEndpoints []string) map[string]interface{} {
func LegacyContainerLinkOptions(parentEndpoints, childEndpoints []string) map[string]any {
return options.Generic{
netlabel.GenericData: options.Generic{
"ParentEndpoints": parentEndpoints,
@@ -1848,7 +1848,7 @@ func (d *driver) IsBuiltIn() bool {
return true
}
func parseContainerOptions(cOptions map[string]interface{}) (*containerConfiguration, error) {
func parseContainerOptions(cOptions map[string]any) (*containerConfiguration, error) {
if cOptions == nil {
return nil, nil
}
@@ -1870,7 +1870,7 @@ func parseContainerOptions(cOptions map[string]interface{}) (*containerConfigura
}
}
func parseConnectivityOptions(cOptions map[string]interface{}) (*connectivityConfiguration, error) {
func parseConnectivityOptions(cOptions map[string]any) (*connectivityConfiguration, error) {
if cOptions == nil {
return nil, nil
}

View File

@@ -294,14 +294,14 @@ func TestCreateFullOptions(t *testing.T) {
br, _ := types.ParseCIDR("172.16.0.1/16")
defgw, _ := types.ParseCIDR("172.16.0.100/16")
genericOption := make(map[string]interface{})
genericOption := make(map[string]any)
genericOption[netlabel.GenericData] = config
if err := d.configure(genericOption); err != nil {
t.Fatalf("Failed to setup driver config: %v", err)
}
netOption := make(map[string]interface{})
netOption := make(map[string]any)
netOption[netlabel.EnableIPv4] = true
netOption[netlabel.EnableIPv6] = true
netOption[netlabel.GenericData] = &networkConfiguration{
@@ -321,7 +321,7 @@ func TestCreateFullOptions(t *testing.T) {
}
// Verify the IP address allocated for the endpoint belongs to the container network
epOptions := make(map[string]interface{})
epOptions := make(map[string]any)
te := newTestEndpoint(cnw, 10)
err = d.CreateEndpoint(context.Background(), "dummy", "ep1", te.Interface(), epOptions)
if err != nil {
@@ -340,7 +340,7 @@ func TestCreateNoConfig(t *testing.T) {
assert.NilError(t, err)
netconfig := &networkConfiguration{BridgeName: DefaultBridgeName, EnableIPv4: true}
genericOption := make(map[string]interface{})
genericOption := make(map[string]any)
genericOption[netlabel.GenericData] = netconfig
if err := d.CreateNetwork(context.Background(), "dummy", genericOption, nil, getIPv4Data(t), nil); err != nil {
@@ -355,7 +355,7 @@ func TestCreateFullOptionsLabels(t *testing.T) {
config := &configuration{
EnableIPForwarding: true,
}
genericOption := make(map[string]interface{})
genericOption := make(map[string]any)
genericOption[netlabel.GenericData] = config
if err := d.configure(genericOption); err != nil {
@@ -378,7 +378,7 @@ func TestCreateFullOptionsLabels(t *testing.T) {
netlabel.HostIPv4: testHostIPv4,
}
netOption := make(map[string]interface{})
netOption := make(map[string]any)
netOption[netlabel.EnableIPv4] = true
netOption[netlabel.EnableIPv6] = true
netOption[netlabel.GenericData] = labels
@@ -443,7 +443,7 @@ func TestCreateFullOptionsLabels(t *testing.T) {
// Check that a MAC address is generated if not already configured.
te1 := newTestEndpoint(ipdList[0].Pool, 20)
err = d.CreateEndpoint(context.Background(), "dummy", "ep1", te1.Interface(), map[string]interface{}{})
err = d.CreateEndpoint(context.Background(), "dummy", "ep1", te1.Interface(), map[string]any{})
assert.NilError(t, err)
assert.Check(t, is.Len(te1.iface.mac, 6))
@@ -451,7 +451,7 @@ func TestCreateFullOptionsLabels(t *testing.T) {
te2 := newTestEndpoint(ipdList[0].Pool, 20)
const macAddr = "aa:bb:cc:dd:ee:ff"
te2.iface.mac = netutils.MustParseMAC(macAddr)
err = d.CreateEndpoint(context.Background(), "dummy", "ep2", te2.Interface(), map[string]interface{}{})
err = d.CreateEndpoint(context.Background(), "dummy", "ep2", te2.Interface(), map[string]any{})
assert.NilError(t, err)
assert.Check(t, is.Equal(te2.iface.mac.String(), macAddr))
}
@@ -544,7 +544,7 @@ func TestCreate(t *testing.T) {
}
netconfig := &networkConfiguration{BridgeName: DefaultBridgeName, EnableIPv4: true}
genericOption := make(map[string]interface{})
genericOption := make(map[string]any)
genericOption[netlabel.GenericData] = netconfig
if err := d.CreateNetwork(context.Background(), "dummy", genericOption, nil, getIPv4Data(t), nil); err != nil {
@@ -570,7 +570,7 @@ func TestCreateFail(t *testing.T) {
}
netconfig := &networkConfiguration{BridgeName: "dummy0", DefaultBridge: true}
genericOption := make(map[string]interface{})
genericOption := make(map[string]any)
genericOption[netlabel.GenericData] = netconfig
if err := d.CreateNetwork(context.Background(), "dummy", genericOption, nil, getIPv4Data(t), nil); err == nil {
@@ -599,7 +599,7 @@ func TestCreateMultipleNetworks(t *testing.T) {
config := &configuration{
EnableIPTables: true,
}
genericOption := make(map[string]interface{})
genericOption := make(map[string]any)
genericOption[netlabel.GenericData] = config
if err := d.configure(genericOption); err != nil {
@@ -607,7 +607,7 @@ func TestCreateMultipleNetworks(t *testing.T) {
}
config1 := &networkConfiguration{BridgeName: "net_test_1", EnableIPv4: true}
genericOption = make(map[string]interface{})
genericOption = make(map[string]any)
genericOption[netlabel.GenericData] = config1
if err := d.CreateNetwork(context.Background(), "1", genericOption, nil, getIPv4Data(t), nil); err != nil {
t.Fatalf("Failed to create bridge: %v", err)
@@ -806,7 +806,7 @@ func testQueryEndpointInfo(t *testing.T, ulPxyEnabled bool) {
config := &configuration{
EnableIPTables: true,
}
genericOption := make(map[string]interface{})
genericOption := make(map[string]any)
genericOption[netlabel.GenericData] = config
if err := d.configure(genericOption); err != nil {
@@ -818,7 +818,7 @@ func testQueryEndpointInfo(t *testing.T, ulPxyEnabled bool) {
EnableIPv4: true,
EnableICC: false,
}
genericOption = make(map[string]interface{})
genericOption = make(map[string]any)
genericOption[netlabel.GenericData] = netconfig
ipdList := getIPv4Data(t)
@@ -827,7 +827,7 @@ func testQueryEndpointInfo(t *testing.T, ulPxyEnabled bool) {
t.Fatalf("Failed to create bridge: %v", err)
}
sbOptions := make(map[string]interface{})
sbOptions := make(map[string]any)
sbOptions[netlabel.PortMap] = getPortMapping()
te := newTestEndpoint(ipdList[0].Pool, 11)
@@ -909,7 +909,7 @@ func TestLinkContainers(t *testing.T) {
config := &configuration{
EnableIPTables: true,
}
genericOption := make(map[string]interface{})
genericOption := make(map[string]any)
genericOption[netlabel.GenericData] = config
if err := d.configure(genericOption); err != nil {
@@ -921,7 +921,7 @@ func TestLinkContainers(t *testing.T) {
EnableIPv4: true,
EnableICC: false,
}
genericOption = make(map[string]interface{})
genericOption = make(map[string]any)
genericOption[netlabel.GenericData] = netconfig
ipdList := getIPv4Data(t)
@@ -937,7 +937,7 @@ func TestLinkContainers(t *testing.T) {
}
exposedPorts := getExposedPorts()
sbOptions := make(map[string]interface{})
sbOptions := make(map[string]any)
sbOptions[netlabel.ExposedPorts] = exposedPorts
err = d.Join(context.Background(), "net1", "ep1", "sbox", te1, nil, sbOptions)
@@ -966,7 +966,7 @@ func TestLinkContainers(t *testing.T) {
t.Fatal("No Ipv4 address assigned to the endpoint: ep2")
}
sbOptions = make(map[string]interface{})
sbOptions = make(map[string]any)
sbOptions[netlabel.GenericData] = options.Generic{
"ChildEndpoints": []string{"ep1"},
}
@@ -1006,7 +1006,7 @@ func TestLinkContainers(t *testing.T) {
checkLink(false)
// Error condition test with an invalid endpoint-id "ep4"
sbOptions = make(map[string]interface{})
sbOptions = make(map[string]any)
sbOptions[netlabel.GenericData] = options.Generic{
"ChildEndpoints": []string{"ep1", "ep4"},
}
@@ -1186,7 +1186,7 @@ func TestSetDefaultGw(t *testing.T) {
gw6 := types.GetIPCopy(ipam6[0].Pool.IP)
gw6[15] = 0x42
option := map[string]interface{}{
option := map[string]any{
netlabel.EnableIPv4: true,
netlabel.EnableIPv6: true,
netlabel.GenericData: &networkConfiguration{
@@ -1253,7 +1253,7 @@ func TestCreateWithExistingBridge(t *testing.T) {
}
netconfig := &networkConfiguration{BridgeName: brName, EnableIPv4: true}
genericOption := make(map[string]interface{})
genericOption := make(map[string]any)
genericOption[netlabel.GenericData] = netconfig
ipv4Data := []driverapi.IPAMData{{
@@ -1309,7 +1309,7 @@ func TestCreateParallel(t *testing.T) {
name := "net" + strconv.Itoa(i)
c.Go(t, func() {
config := &networkConfiguration{BridgeName: name, EnableIPv4: true}
genericOption := make(map[string]interface{})
genericOption := make(map[string]any)
genericOption[netlabel.GenericData] = config
if err := d.CreateNetwork(context.Background(), name, genericOption, nil, ipV4Data, nil); err != nil {
ch <- fmt.Errorf("failed to create %s", name)
@@ -1351,7 +1351,7 @@ func TestSetupIP6TablesWithHostIPv4(t *testing.T) {
EnableIPTables: true,
EnableIP6Tables: true,
}
if err := d.configure(map[string]interface{}{netlabel.GenericData: dc}); err != nil {
if err := d.configure(map[string]any{netlabel.GenericData: dc}); err != nil {
t.Fatal(err)
}
nc := &networkConfiguration{

View File

@@ -138,7 +138,7 @@ func (d *driver) storeDelete(kvObject datastore.KVObject) error {
}
func (ncfg *networkConfiguration) MarshalJSON() ([]byte, error) {
nMap := make(map[string]interface{})
nMap := make(map[string]any)
nMap["ID"] = ncfg.ID
nMap["BridgeName"] = ncfg.BridgeName
nMap["EnableIPv4"] = ncfg.EnableIPv4
@@ -175,7 +175,7 @@ func (ncfg *networkConfiguration) MarshalJSON() ([]byte, error) {
func (ncfg *networkConfiguration) UnmarshalJSON(b []byte) error {
var (
err error
nMap map[string]interface{}
nMap map[string]any
)
if err = json.Unmarshal(b, &nMap); err != nil {
@@ -294,7 +294,7 @@ func (ncfg *networkConfiguration) CopyTo(o datastore.KVObject) error {
}
func (ep *bridgeEndpoint) MarshalJSON() ([]byte, error) {
epMap := make(map[string]interface{})
epMap := make(map[string]any)
epMap["id"] = ep.id
epMap["nid"] = ep.nid
epMap["SrcName"] = ep.srcName
@@ -315,7 +315,7 @@ func (ep *bridgeEndpoint) MarshalJSON() ([]byte, error) {
func (ep *bridgeEndpoint) UnmarshalJSON(b []byte) error {
var (
err error
epMap map[string]interface{}
epMap map[string]any
)
if err = json.Unmarshal(b, &epMap); err != nil {

View File

@@ -28,7 +28,7 @@ func (d *driver) NetworkFree(id string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]any, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
return types.NotImplementedErrorf("not implemented")
}
@@ -36,7 +36,7 @@ func (d *driver) DeleteNetwork(nid string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]any) error {
return types.NotImplementedErrorf("not implemented")
}
@@ -44,11 +44,11 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, error) {
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]any, error) {
return nil, types.NotImplementedErrorf("not implemented")
}
func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, _ map[string]interface{}) error {
func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, _ map[string]any) error {
return types.NotImplementedErrorf("not implemented")
}

View File

@@ -21,7 +21,7 @@ func TestLinkCreate(t *testing.T) {
assert.NilError(t, err)
mtu := 1490
option := map[string]interface{}{
option := map[string]any{
netlabel.GenericData: &networkConfiguration{
BridgeName: DefaultBridgeName,
EnableIPv4: true,
@@ -83,7 +83,7 @@ func TestLinkCreateTwo(t *testing.T) {
err := d.configure(nil)
assert.NilError(t, err)
option := map[string]interface{}{
option := map[string]any{
netlabel.GenericData: &networkConfiguration{
BridgeName: DefaultBridgeName,
EnableIPv4: true,
@@ -111,7 +111,7 @@ func TestLinkCreateNoEnableIPv6(t *testing.T) {
err := d.configure(nil)
assert.NilError(t, err)
option := map[string]interface{}{
option := map[string]any{
netlabel.GenericData: &networkConfiguration{
BridgeName: DefaultBridgeName,
EnableIPv4: true,
@@ -136,7 +136,7 @@ func TestLinkDelete(t *testing.T) {
err := d.configure(nil)
assert.NilError(t, err)
option := map[string]interface{}{
option := map[string]any{
netlabel.GenericData: &networkConfiguration{
BridgeName: DefaultBridgeName,
EnableIPv4: true,

View File

@@ -47,7 +47,7 @@ func TestPortMappingConfig(t *testing.T) {
EnableIPTables: true,
Hairpin: true,
}
genericOption := make(map[string]interface{})
genericOption := make(map[string]any)
genericOption[netlabel.GenericData] = config
if err := d.configure(genericOption); err != nil {
@@ -59,10 +59,10 @@ func TestPortMappingConfig(t *testing.T) {
binding3 := types.PortBinding{Proto: types.TCP, Port: 500, HostPort: 65000}
portBindings := []types.PortBinding{binding1, binding2, binding3}
sbOptions := make(map[string]interface{})
sbOptions := make(map[string]any)
sbOptions[netlabel.PortMap] = portBindings
netOptions := map[string]interface{}{
netOptions := map[string]any{
netlabel.GenericData: &networkConfiguration{
BridgeName: DefaultBridgeName,
EnableIPv4: true,
@@ -137,7 +137,7 @@ func TestPortMappingV6Config(t *testing.T) {
EnableIPTables: true,
EnableIP6Tables: true,
}
genericOption := make(map[string]interface{})
genericOption := make(map[string]any)
genericOption[netlabel.GenericData] = config
if err := d.configure(genericOption); err != nil {
@@ -150,13 +150,13 @@ func TestPortMappingV6Config(t *testing.T) {
{Proto: types.SCTP, Port: 500, HostPort: 65000},
}
sbOptions := make(map[string]interface{})
sbOptions := make(map[string]any)
sbOptions[netlabel.PortMap] = portBindings
netConfig := &networkConfiguration{
BridgeName: DefaultBridgeName,
EnableIPv6: true,
}
netOptions := make(map[string]interface{})
netOptions := make(map[string]any)
netOptions[netlabel.GenericData] = netConfig
ipdList4 := getIPv4Data(t)
@@ -787,7 +787,7 @@ func TestAddPortMappings(t *testing.T) {
bridge: &bridgeInterface{},
driver: newDriver(storeutils.NewTempStore(t), pms),
}
genericOption := map[string]interface{}{
genericOption := map[string]any{
netlabel.GenericData: &configuration{
EnableIPTables: true,
EnableIP6Tables: true,

View File

@@ -31,7 +31,7 @@ func (d *driver) NetworkFree(id string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]any, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
d.Lock()
defer d.Unlock()
@@ -48,7 +48,7 @@ func (d *driver) DeleteNetwork(nid string) error {
return types.ForbiddenErrorf("network of type %q cannot be deleted", NetworkType)
}
func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]any) error {
return nil
}
@@ -56,12 +56,12 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
return nil
}
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, error) {
return make(map[string]interface{}), nil
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]any, error) {
return make(map[string]any), nil
}
// Join method is invoked when a Sandbox is attached to an endpoint.
func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, _ map[string]interface{}) error {
func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, _ map[string]any) error {
return nil
}

View File

@@ -62,7 +62,7 @@ type network struct {
}
// Register initializes and registers the libnetwork ipvlan driver.
func Register(r driverapi.Registerer, store *datastore.Store, config map[string]interface{}) error {
func Register(r driverapi.Registerer, store *datastore.Store, config map[string]any) error {
d := &driver{
store: store,
networks: networkTable{},
@@ -84,8 +84,8 @@ func (d *driver) NetworkFree(id string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, error) {
return make(map[string]interface{}), nil
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]any, error) {
return make(map[string]any), nil
}
func (d *driver) Type() string {

View File

@@ -16,7 +16,7 @@ import (
)
// CreateEndpoint assigns the mac, ip and endpoint id for the new container
func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]any) error {
if err := validateID(nid, eid); err != nil {
return err
}

View File

@@ -30,7 +30,7 @@ const (
)
// Join method is invoked when a Sandbox is attached to an endpoint.
func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, epOpts, _ map[string]interface{}) error {
func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, epOpts, _ map[string]any) error {
ctx, span := otel.Tracer("").Start(ctx, "libnetwork.drivers.ipvlan.Join", trace.WithAttributes(
attribute.String("nid", nid),
attribute.String("eid", eid),

View File

@@ -18,7 +18,7 @@ import (
)
// CreateNetwork the network for the specified driver type
func (d *driver) CreateNetwork(ctx context.Context, nid string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
func (d *driver) CreateNetwork(ctx context.Context, nid string, option map[string]any, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
kv, err := kernel.GetKernelVersion()
if err != nil {
return fmt.Errorf("failed to check kernel version for ipvlan driver support: %v", err)
@@ -240,7 +240,7 @@ func parseNetworkOptions(id string, option options.Generic) (*configuration, err
}
// parseNetworkGenericOptions parse generic driver docker network options
func parseNetworkGenericOptions(data interface{}) (*configuration, error) {
func parseNetworkGenericOptions(data any) (*configuration, error) {
switch opt := data.(type) {
case *configuration:
return opt, nil

View File

@@ -126,7 +126,7 @@ func (d *driver) storeDelete(kvObject datastore.KVObject) error {
}
func (config *configuration) MarshalJSON() ([]byte, error) {
nMap := make(map[string]interface{})
nMap := make(map[string]any)
nMap["ID"] = config.ID
nMap["Mtu"] = config.Mtu
nMap["Parent"] = config.Parent
@@ -155,7 +155,7 @@ func (config *configuration) MarshalJSON() ([]byte, error) {
func (config *configuration) UnmarshalJSON(b []byte) error {
var (
err error
nMap map[string]interface{}
nMap map[string]any
)
if err = json.Unmarshal(b, &nMap); err != nil {
@@ -235,7 +235,7 @@ func (config *configuration) CopyTo(o datastore.KVObject) error {
}
func (ep *endpoint) MarshalJSON() ([]byte, error) {
epMap := make(map[string]interface{})
epMap := make(map[string]any)
epMap["id"] = ep.id
epMap["nid"] = ep.nid
epMap["SrcName"] = ep.srcName
@@ -254,7 +254,7 @@ func (ep *endpoint) MarshalJSON() ([]byte, error) {
func (ep *endpoint) UnmarshalJSON(b []byte) error {
var (
err error
epMap map[string]interface{}
epMap map[string]any
)
if err = json.Unmarshal(b, &epMap); err != nil {

View File

@@ -28,7 +28,7 @@ func (d *driver) NetworkFree(id string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]any, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
return types.NotImplementedErrorf("not implemented")
}
@@ -36,7 +36,7 @@ func (d *driver) DeleteNetwork(nid string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]any) error {
return types.NotImplementedErrorf("not implemented")
}
@@ -44,11 +44,11 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, error) {
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]any, error) {
return nil, types.NotImplementedErrorf("not implemented")
}
func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, _ map[string]interface{}) error {
func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, _ map[string]any) error {
return types.NotImplementedErrorf("not implemented")
}

View File

@@ -56,7 +56,7 @@ type network struct {
}
// Register initializes and registers the libnetwork macvlan driver
func Register(r driverapi.Registerer, store *datastore.Store, _ map[string]interface{}) error {
func Register(r driverapi.Registerer, store *datastore.Store, _ map[string]any) error {
d := &driver{
store: store,
networks: networkTable{},
@@ -78,8 +78,8 @@ func (d *driver) NetworkFree(id string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, error) {
return make(map[string]interface{}), nil
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]any, error) {
return make(map[string]any), nil
}
func (d *driver) Type() string {

View File

@@ -16,7 +16,7 @@ import (
)
// CreateEndpoint assigns the mac, ip and endpoint id for the new container
func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]any) error {
if err := validateID(nid, eid); err != nil {
return err
}

View File

@@ -18,7 +18,7 @@ import (
)
// Join method is invoked when a Sandbox is attached to an endpoint.
func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, epOpts, _ map[string]interface{}) error {
func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, epOpts, _ map[string]any) error {
ctx, span := otel.Tracer("").Start(ctx, "libnetwork.drivers.macvlan.Join", trace.WithAttributes(
attribute.String("nid", nid),
attribute.String("eid", eid),

View File

@@ -17,7 +17,7 @@ import (
)
// CreateNetwork the network for the specified driver type
func (d *driver) CreateNetwork(ctx context.Context, nid string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
func (d *driver) CreateNetwork(ctx context.Context, nid string, option map[string]any, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
// reject a null v4 network if ipv4 is required
if v, ok := option[netlabel.EnableIPv4]; ok && v.(bool) {
if len(ipV4Data) == 0 || ipV4Data[0].Pool.String() == "0.0.0.0/0" {
@@ -241,7 +241,7 @@ func parseNetworkOptions(id string, option options.Generic) (*configuration, err
}
// parseNetworkGenericOptions parses generic driver docker network options
func parseNetworkGenericOptions(data interface{}) (*configuration, error) {
func parseNetworkGenericOptions(data any) (*configuration, error) {
switch opt := data.(type) {
case *configuration:
return opt, nil

View File

@@ -125,7 +125,7 @@ func (d *driver) storeDelete(kvObject datastore.KVObject) error {
}
func (config *configuration) MarshalJSON() ([]byte, error) {
nMap := make(map[string]interface{})
nMap := make(map[string]any)
nMap["ID"] = config.ID
nMap["Mtu"] = config.Mtu
nMap["Parent"] = config.Parent
@@ -153,7 +153,7 @@ func (config *configuration) MarshalJSON() ([]byte, error) {
func (config *configuration) UnmarshalJSON(b []byte) error {
var (
err error
nMap map[string]interface{}
nMap map[string]any
)
if err = json.Unmarshal(b, &nMap); err != nil {
@@ -229,7 +229,7 @@ func (config *configuration) CopyTo(o datastore.KVObject) error {
}
func (ep *endpoint) MarshalJSON() ([]byte, error) {
epMap := make(map[string]interface{})
epMap := make(map[string]any)
epMap["id"] = ep.id
epMap["nid"] = ep.nid
epMap["SrcName"] = ep.srcName
@@ -248,7 +248,7 @@ func (ep *endpoint) MarshalJSON() ([]byte, error) {
func (ep *endpoint) UnmarshalJSON(b []byte) error {
var (
err error
epMap map[string]interface{}
epMap map[string]any
)
if err = json.Unmarshal(b, &epMap); err != nil {

View File

@@ -28,7 +28,7 @@ func (d *driver) NetworkFree(id string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]any, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
return types.NotImplementedErrorf("not implemented")
}
@@ -36,7 +36,7 @@ func (d *driver) DeleteNetwork(nid string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]any) error {
return types.NotImplementedErrorf("not implemented")
}
@@ -44,11 +44,11 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, error) {
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]any, error) {
return nil, types.NotImplementedErrorf("not implemented")
}
func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, _ map[string]interface{}) error {
func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, _ map[string]any) error {
return types.NotImplementedErrorf("not implemented")
}

View File

@@ -31,7 +31,7 @@ func (d *driver) NetworkFree(id string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]any, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
d.Lock()
defer d.Unlock()
@@ -48,7 +48,7 @@ func (d *driver) DeleteNetwork(nid string) error {
return types.ForbiddenErrorf("network of type %q cannot be deleted", NetworkType)
}
func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]any) error {
return nil
}
@@ -56,12 +56,12 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
return nil
}
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, error) {
return make(map[string]interface{}), nil
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]any, error) {
return make(map[string]any), nil
}
// Join method is invoked when a Sandbox is attached to an endpoint.
func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, _ map[string]interface{}) error {
func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, _ map[string]any) error {
return nil
}

View File

@@ -23,7 +23,7 @@ import (
)
// Join method is invoked when a Sandbox is attached to an endpoint.
func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, epOpts, _ map[string]interface{}) error {
func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, epOpts, _ map[string]any) error {
ctx, span := otel.Tracer("").Start(ctx, "libnetwork.drivers.overlay.Join", trace.WithAttributes(
attribute.String("nid", nid),
attribute.String("eid", eid),

View File

@@ -26,7 +26,7 @@ type endpoint struct {
addr netip.Prefix
}
func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]any) error {
var err error
if err = validateID(nid, eid); err != nil {
return err
@@ -117,6 +117,6 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
return nil
}
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, error) {
return make(map[string]interface{}), nil
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]any, error) {
return make(map[string]any), nil
}

View File

@@ -91,7 +91,7 @@ func (d *driver) NetworkFree(id string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]any, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
if id == "" {
return errors.New("invalid network id")
}

View File

@@ -33,7 +33,7 @@ var (
type driver struct {
// Immutable; mu does not need to be held when accessing these fields.
config map[string]interface{}
config map[string]any
initOS sync.Once
// encrMu guards secMap and keys,
@@ -58,7 +58,7 @@ type driver struct {
}
// Register registers a new instance of the overlay driver.
func Register(r driverapi.Registerer, config map[string]interface{}) error {
func Register(r driverapi.Registerer, config map[string]any) error {
d := &driver{
networks: networkTable{},
secMap: encrMap{},
@@ -113,7 +113,7 @@ func (d *driver) nodeJoin(data discoverapi.NodeDiscoveryData) error {
}
// DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data any) error {
switch dType {
case discoverapi.NodeDiscovery:
nodeData, ok := data.(discoverapi.NodeDiscoveryData)
@@ -170,6 +170,6 @@ func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{})
}
// DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
func (d *driver) DiscoverDelete(dType discoverapi.DiscoveryType, data interface{}) error {
func (d *driver) DiscoverDelete(dType discoverapi.DiscoveryType, data any) error {
return nil
}

View File

@@ -163,7 +163,7 @@ func (n *network) releaseVxlanID() {
}
}
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]any, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
return types.NotImplementedErrorf("not implemented")
}
@@ -171,7 +171,7 @@ func (d *driver) DeleteNetwork(nid string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]any) error {
return types.NotImplementedErrorf("not implemented")
}
@@ -179,12 +179,12 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, error) {
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]any, error) {
return nil, types.NotImplementedErrorf("not implemented")
}
// Join method is invoked when a Sandbox is attached to an endpoint.
func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, _ map[string]interface{}) error {
func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, _ map[string]any) error {
return types.NotImplementedErrorf("not implemented")
}

View File

@@ -70,7 +70,7 @@ type FreeNetworkResponse struct {
// [CreateNetworkRequest].
type GwAllocCheckerRequest struct {
// Options has the same form as Options in [CreateNetworkRequest].
Options map[string]interface{}
Options map[string]any
}
// GwAllocCheckerResponse is the response to a [GwAllocCheckerRequest].
@@ -93,7 +93,7 @@ type CreateNetworkRequest struct {
NetworkID string
// A free form map->object interface for communication of options.
Options map[string]interface{}
Options map[string]any
// IPAMData contains the address pool information for this network
IPv4Data, IPv6Data []driverapi.IPAMData
@@ -122,7 +122,7 @@ type CreateEndpointRequest struct {
// The ID of the endpoint for later reference.
EndpointID string
Interface *EndpointInterface
Options map[string]interface{}
Options map[string]any
}
// EndpointInterface represents an interface endpoint.
@@ -165,7 +165,7 @@ type EndpointInfoRequest struct {
// EndpointInfoResponse is the response to an EndpointInfoRequest.
type EndpointInfoResponse struct {
Response
Value map[string]interface{}
Value map[string]any
}
// JoinRequest describes the API for joining an endpoint to a sandbox.
@@ -173,7 +173,7 @@ type JoinRequest struct {
NetworkID string
EndpointID string
SandboxKey string
Options map[string]interface{}
Options map[string]any
}
// InterfaceName is the struct representation of a pair of devices with source
@@ -216,7 +216,7 @@ type LeaveResponse struct {
type ProgramExternalConnectivityRequest struct {
NetworkID string
EndpointID string
Options map[string]interface{}
Options map[string]any
}
// ProgramExternalConnectivityResponse is the answer to ProgramExternalConnectivityRequest.
@@ -238,7 +238,7 @@ type RevokeExternalConnectivityResponse struct {
// DiscoveryNotification represents a discovery notification
type DiscoveryNotification struct {
DiscoveryType discoverapi.DiscoveryType
DiscoveryData interface{}
DiscoveryData any
}
// DiscoveryResponse is used by libnetwork to log any plugin error processing the discovery notifications

View File

@@ -138,11 +138,11 @@ func (d *driver) getCapabilities() (*driverapi.Capability, error) {
// Config is not implemented for remote drivers, since it is assumed
// to be supplied to the remote process out-of-band (e.g., as command
// line arguments).
func (d *driver) Config(option map[string]interface{}) error {
func (d *driver) Config(option map[string]any) error {
return &driverapi.ErrNotImplemented{}
}
func (d *driver) call(methodName string, arg interface{}, retVal maybeError) error {
func (d *driver) call(methodName string, arg any, retVal maybeError) error {
method := driverapi.NetworkPluginEndpointType + "." + methodName
err := d.endpoint.Call(method, arg, retVal)
if err != nil {
@@ -171,7 +171,7 @@ func (d *driver) NetworkFree(id string) error {
return d.call("FreeNetwork", fr, &api.FreeNetworkResponse{})
}
func (d *driver) CreateNetwork(ctx context.Context, id string, options map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
func (d *driver) CreateNetwork(ctx context.Context, id string, options map[string]any, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
create := &api.CreateNetworkRequest{
NetworkID: id,
Options: options,
@@ -196,7 +196,7 @@ func (d *driver) DeleteNetwork(nid string) error {
return d.call("DeleteNetwork", &api.DeleteNetworkRequest{NetworkID: nid}, &api.DeleteNetworkResponse{})
}
func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) (retErr error) {
func (d *driver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]any) (retErr error) {
if ifInfo == nil {
return errors.New("must not be called with nil InterfaceInfo")
}
@@ -269,7 +269,7 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
return d.call("DeleteEndpoint", deleteRequest, &api.DeleteEndpointResponse{})
}
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, error) {
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]any, error) {
info := &api.EndpointInfoRequest{
NetworkID: nid,
EndpointID: eid,
@@ -282,7 +282,7 @@ func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, erro
}
// Join method is invoked when a Sandbox is attached to an endpoint.
func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, options map[string]interface{}) (retErr error) {
func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, options map[string]any) (retErr error) {
join := &api.JoinRequest{
NetworkID: nid,
EndpointID: eid,
@@ -437,7 +437,7 @@ func (d *driver) IsBuiltIn() bool {
}
// DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data any) error {
if dType != discoverapi.NodeDiscovery {
return nil
}
@@ -449,7 +449,7 @@ func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{})
}
// DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
func (d *driver) DiscoverDelete(dType discoverapi.DiscoveryType, data interface{}) error {
func (d *driver) DiscoverDelete(dType discoverapi.DiscoveryType, data any) error {
if dType != discoverapi.NodeDiscovery {
return nil
}

View File

@@ -24,9 +24,9 @@ import (
"gotest.tools/v3/assert"
)
func handle(t *testing.T, mux *http.ServeMux, method string, h func(map[string]interface{}) interface{}) {
func handle(t *testing.T, mux *http.ServeMux, method string, h func(map[string]any) any) {
mux.HandleFunc(fmt.Sprintf("/%s.%s", driverapi.NetworkPluginEndpointType, method), func(w http.ResponseWriter, r *http.Request) {
var ask map[string]interface{}
var ask map[string]any
err := json.NewDecoder(r.Body).Decode(&ask)
if err != nil && !errors.Is(err, io.EOF) {
t.Fatal(err)
@@ -218,8 +218,8 @@ func TestGetEmptyCapabilities(t *testing.T) {
mux := http.NewServeMux()
defer setupPlugin(t, plugin, mux)()
handle(t, mux, "GetCapabilities", func(msg map[string]interface{}) interface{} {
return map[string]interface{}{}
handle(t, mux, "GetCapabilities", func(msg map[string]any) any {
return map[string]any{}
})
p, err := plugins.Get(plugin, driverapi.NetworkPluginEndpointType)
@@ -248,8 +248,8 @@ func TestGetExtraCapabilities(t *testing.T) {
mux := http.NewServeMux()
defer setupPlugin(t, plugin, mux)()
handle(t, mux, "GetCapabilities", func(msg map[string]interface{}) interface{} {
return map[string]interface{}{
handle(t, mux, "GetCapabilities", func(msg map[string]any) any {
return map[string]any{
"Scope": "local",
"foo": "bar",
"ConnectivityScope": "global",
@@ -286,8 +286,8 @@ func TestGetInvalidCapabilities(t *testing.T) {
mux := http.NewServeMux()
defer setupPlugin(t, plugin, mux)()
handle(t, mux, "GetCapabilities", func(msg map[string]interface{}) interface{} {
return map[string]interface{}{
handle(t, mux, "GetCapabilities", func(msg map[string]any) any {
return map[string]any{
"Scope": "fake",
}
})
@@ -336,60 +336,60 @@ func TestRemoteDriver(t *testing.T) {
var networkID string
handle(t, mux, "GetCapabilities", func(msg map[string]interface{}) interface{} {
return map[string]interface{}{
handle(t, mux, "GetCapabilities", func(msg map[string]any) any {
return map[string]any{
"Scope": "global",
"GwAllocChecker": true,
}
})
handle(t, mux, "GwAllocCheck", func(msg map[string]interface{}) interface{} {
options := msg["Options"].(map[string]interface{})
return map[string]interface{}{
handle(t, mux, "GwAllocCheck", func(msg map[string]any) any {
options := msg["Options"].(map[string]any)
return map[string]any{
"SkipIPv4": options["skip4"].(bool),
"SkipIPv6": options["skip6"].(bool),
}
})
handle(t, mux, "CreateNetwork", func(msg map[string]interface{}) interface{} {
handle(t, mux, "CreateNetwork", func(msg map[string]any) any {
nid := msg["NetworkID"]
var ok bool
if networkID, ok = nid.(string); !ok {
t.Fatal("RPC did not include network ID string")
}
return map[string]interface{}{}
return map[string]any{}
})
handle(t, mux, "DeleteNetwork", func(msg map[string]interface{}) interface{} {
handle(t, mux, "DeleteNetwork", func(msg map[string]any) any {
if nid, ok := msg["NetworkID"]; !ok || nid != networkID {
t.Fatal("Network ID missing or does not match that created")
}
return map[string]interface{}{}
return map[string]any{}
})
handle(t, mux, "CreateEndpoint", func(msg map[string]interface{}) interface{} {
iface := map[string]interface{}{
handle(t, mux, "CreateEndpoint", func(msg map[string]any) any {
iface := map[string]any{
"MacAddress": ep.macAddress,
"Address": ep.address,
"AddressIPv6": ep.addressIPv6,
}
return map[string]interface{}{
return map[string]any{
"Interface": iface,
}
})
handle(t, mux, "Join", func(msg map[string]interface{}) interface{} {
opts := msg["Options"].(map[string]interface{})
handle(t, mux, "Join", func(msg map[string]any) any {
opts := msg["Options"].(map[string]any)
foo, ok := opts["foo"].(string)
if !ok || foo != "fooValue" {
t.Fatalf("Did not receive expected foo string in request options: %+v", msg)
}
return map[string]interface{}{
return map[string]any{
"Gateway": ep.gateway,
"GatewayIPv6": ep.gatewayIPv6,
"HostsPath": ep.hostsPath,
"ResolvConfPath": ep.resolvConfPath,
"InterfaceName": map[string]interface{}{
"InterfaceName": map[string]any{
"SrcName": ep.srcName,
"DstPrefix": ep.dstPrefix,
"DstName": ep.dstName,
},
"StaticRoutes": []map[string]interface{}{
"StaticRoutes": []map[string]any{
{
"Destination": ep.destination,
"RouteType": ep.routeType,
@@ -398,25 +398,25 @@ func TestRemoteDriver(t *testing.T) {
},
}
})
handle(t, mux, "Leave", func(msg map[string]interface{}) interface{} {
handle(t, mux, "Leave", func(msg map[string]any) any {
return map[string]string{}
})
handle(t, mux, "DeleteEndpoint", func(msg map[string]interface{}) interface{} {
return map[string]interface{}{}
handle(t, mux, "DeleteEndpoint", func(msg map[string]any) any {
return map[string]any{}
})
handle(t, mux, "EndpointOperInfo", func(msg map[string]interface{}) interface{} {
return map[string]interface{}{
handle(t, mux, "EndpointOperInfo", func(msg map[string]any) any {
return map[string]any{
"Value": map[string]string{
"Arbitrary": "key",
"Value": "pairs?",
},
}
})
handle(t, mux, "DiscoverNew", func(msg map[string]interface{}) interface{} {
handle(t, mux, "DiscoverNew", func(msg map[string]any) any {
return map[string]string{}
})
handle(t, mux, "DiscoverDelete", func(msg map[string]interface{}) interface{} {
return map[string]interface{}{}
handle(t, mux, "DiscoverDelete", func(msg map[string]any) any {
return map[string]any{}
})
p, err := plugins.Get(plugin, driverapi.NetworkPluginEndpointType)
@@ -454,14 +454,14 @@ func TestRemoteDriver(t *testing.T) {
}
netID := "dummy-network"
err = d.CreateNetwork(context.Background(), netID, map[string]interface{}{}, nil, nil, nil)
err = d.CreateNetwork(context.Background(), netID, map[string]any{}, nil, nil, nil)
if err != nil {
t.Fatal(err)
}
endID := "dummy-endpoint"
ifInfo := &testEndpoint{}
err = d.CreateEndpoint(context.Background(), netID, endID, ifInfo, map[string]interface{}{})
err = d.CreateEndpoint(context.Background(), netID, endID, ifInfo, map[string]any{})
if err != nil {
t.Fatal(err)
}
@@ -473,7 +473,7 @@ func TestRemoteDriver(t *testing.T) {
ifInfo.MacAddress(), ifInfo.Address(), ifInfo.AddressIPv6())
}
joinOpts := map[string]interface{}{"foo": "fooValue"}
joinOpts := map[string]any{"foo": "fooValue"}
err = d.Join(context.Background(), netID, endID, "sandbox-key", ep, nil, joinOpts)
if err != nil {
t.Fatal(err)
@@ -508,8 +508,8 @@ func TestDriverError(t *testing.T) {
mux := http.NewServeMux()
defer setupPlugin(t, plugin, mux)()
handle(t, mux, "CreateEndpoint", func(msg map[string]interface{}) interface{} {
return map[string]interface{}{
handle(t, mux, "CreateEndpoint", func(msg map[string]any) any {
return map[string]any{
"Err": "this should get raised as an error",
}
})
@@ -525,7 +525,7 @@ func TestDriverError(t *testing.T) {
}
d := newDriver(plugin, client)
if err := d.CreateEndpoint(context.Background(), "dummy", "dummy", &testEndpoint{t: t}, map[string]interface{}{}); err == nil {
if err := d.CreateEndpoint(context.Background(), "dummy", "dummy", &testEndpoint{t: t}, map[string]any{}); err == nil {
t.Fatal("Expected error from driver")
}
}
@@ -540,13 +540,13 @@ func TestMissingValues(t *testing.T) {
t: t,
}
handle(t, mux, "CreateEndpoint", func(msg map[string]interface{}) interface{} {
iface := map[string]interface{}{
handle(t, mux, "CreateEndpoint", func(msg map[string]any) any {
iface := map[string]any{
"Address": ep.address,
"AddressIPv6": ep.addressIPv6,
"MacAddress": ep.macAddress,
}
return map[string]interface{}{
return map[string]any{
"Interface": iface,
}
})
@@ -562,7 +562,7 @@ func TestMissingValues(t *testing.T) {
}
d := newDriver(plugin, client)
if err := d.CreateEndpoint(context.Background(), "dummy", "dummy", ep, map[string]interface{}{}); err != nil {
if err := d.CreateEndpoint(context.Background(), "dummy", "dummy", ep, map[string]any{}); err != nil {
t.Fatal(err)
}
}
@@ -605,19 +605,19 @@ func TestRollback(t *testing.T) {
rolledback := false
handle(t, mux, "CreateEndpoint", func(msg map[string]interface{}) interface{} {
iface := map[string]interface{}{
handle(t, mux, "CreateEndpoint", func(msg map[string]any) any {
iface := map[string]any{
"Address": "192.168.4.5/16",
"AddressIPv6": "",
"MacAddress": "7a:12:34:56:78:90",
}
return map[string]interface{}{
"Interface": interface{}(iface),
return map[string]any{
"Interface": any(iface),
}
})
handle(t, mux, "DeleteEndpoint", func(msg map[string]interface{}) interface{} {
handle(t, mux, "DeleteEndpoint", func(msg map[string]any) any {
rolledback = true
return map[string]interface{}{}
return map[string]any{}
})
p, err := plugins.Get(plugin, driverapi.NetworkPluginEndpointType)
@@ -632,7 +632,7 @@ func TestRollback(t *testing.T) {
d := newDriver(plugin, client)
ep := &rollbackEndpoint{}
if err := d.CreateEndpoint(context.Background(), "dummy", "dummy", ep.Interface(), map[string]interface{}{}); err == nil {
if err := d.CreateEndpoint(context.Background(), "dummy", "dummy", ep.Interface(), map[string]any{}); err == nil {
t.Fatal("Expected error from driver")
}
if !rolledback {

View File

@@ -14,7 +14,7 @@ import (
)
// Join method is invoked when a Sandbox is attached to an endpoint.
func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, options map[string]interface{}) error {
func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, options map[string]any) error {
ctx, span := otel.Tracer("").Start(ctx, "libnetwork.drivers.windows_overlay.Join", trace.WithAttributes(
attribute.String("nid", nid),
attribute.String("eid", eid),

View File

@@ -85,7 +85,7 @@ func (n *network) removeEndpointWithAddress(addr *net.IPNet) {
}
}
func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]any) error {
var err error
if err = validateID(nid, eid); err != nil {
return err
@@ -239,7 +239,7 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
return nil
}
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, error) {
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]any, error) {
if err := validateID(nid, eid); err != nil {
return nil, err
}
@@ -254,7 +254,7 @@ func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, erro
return nil, fmt.Errorf("endpoint id %q not found", eid)
}
data := make(map[string]interface{}, 1)
data := make(map[string]any, 1)
data["hnsid"] = ep.profileID
data["AllowUnqualifiedDNSQuery"] = true

View File

@@ -62,7 +62,7 @@ func (d *driver) NetworkFree(id string) error {
return types.NotImplementedErrorf("not implemented")
}
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]any, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
var (
networkName string
interfaceName string

View File

@@ -322,7 +322,7 @@ func (d *driver) createNetwork(config *networkConfiguration) *hnsNetwork {
}
// Create a new network
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
func (d *driver) CreateNetwork(ctx context.Context, id string, option map[string]any, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
if _, err := d.getNetwork(id); err == nil {
return types.ForbiddenErrorf("network %s exists", id)
}
@@ -585,7 +585,7 @@ func ParsePortBindingPolicies(policies []json.RawMessage) ([]types.PortBinding,
return bindings, nil
}
func parseEndpointOptions(epOptions map[string]interface{}) (*endpointOption, error) {
func parseEndpointOptions(epOptions map[string]any) (*endpointOption, error) {
if epOptions == nil {
return nil, nil
}
@@ -636,7 +636,7 @@ func parseEndpointOptions(epOptions map[string]interface{}) (*endpointOption, er
}
// ParseEndpointConnectivity parses options passed to CreateEndpoint, specifically port bindings, and store in a endpointConnectivity object.
func ParseEndpointConnectivity(epOptions map[string]interface{}) (*EndpointConnectivity, error) {
func ParseEndpointConnectivity(epOptions map[string]any) (*EndpointConnectivity, error) {
if epOptions == nil {
return nil, nil
}
@@ -661,7 +661,7 @@ func ParseEndpointConnectivity(epOptions map[string]interface{}) (*EndpointConne
return ec, nil
}
func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]any) error {
ctx, span := otel.Tracer("").Start(ctx, fmt.Sprintf("libnetwork.drivers.windows_%s.CreateEndpoint", d.name), trace.WithAttributes(
attribute.String("nid", nid),
attribute.String("eid", eid)))
@@ -845,7 +845,7 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
return nil
}
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, error) {
func (d *driver) EndpointOperInfo(nid, eid string) (map[string]any, error) {
network, err := d.getNetwork(nid)
if err != nil {
return nil, err
@@ -856,7 +856,7 @@ func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, erro
return nil, err
}
data := make(map[string]interface{}, 1)
data := make(map[string]any, 1)
if network.driver.name == "nat" {
data["AllowUnqualifiedDNSQuery"] = true
}
@@ -887,7 +887,7 @@ func (d *driver) EndpointOperInfo(nid, eid string) (map[string]interface{}, erro
}
// Join method is invoked when a Sandbox is attached to an endpoint.
func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, options map[string]interface{}) error {
func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, options map[string]any) error {
ctx, span := otel.Tracer("").Start(ctx, fmt.Sprintf("libnetwork.drivers.windows_%s.Join", d.name), trace.WithAttributes(
attribute.String("nid", nid),
attribute.String("eid", eid),

View File

@@ -109,7 +109,7 @@ func (d *driver) storeDelete(kvObject datastore.KVObject) error {
}
func (ncfg *networkConfiguration) MarshalJSON() ([]byte, error) {
nMap := make(map[string]interface{})
nMap := make(map[string]any)
nMap["ID"] = ncfg.ID
nMap["Type"] = ncfg.Type
@@ -128,7 +128,7 @@ func (ncfg *networkConfiguration) MarshalJSON() ([]byte, error) {
func (ncfg *networkConfiguration) UnmarshalJSON(b []byte) error {
var (
err error
nMap map[string]interface{}
nMap map[string]any
)
if err = json.Unmarshal(b, &nMap); err != nil {
@@ -196,7 +196,7 @@ func (ncfg *networkConfiguration) CopyTo(o datastore.KVObject) error {
}
func (ep *hnsEndpoint) MarshalJSON() ([]byte, error) {
epMap := make(map[string]interface{})
epMap := make(map[string]any)
epMap["id"] = ep.id
epMap["nid"] = ep.nid
epMap["Type"] = ep.Type
@@ -218,7 +218,7 @@ func (ep *hnsEndpoint) MarshalJSON() ([]byte, error) {
func (ep *hnsEndpoint) UnmarshalJSON(b []byte) error {
var (
err error
epMap map[string]interface{}
epMap map[string]any
)
if err = json.Unmarshal(b, &epMap); err != nil {

View File

@@ -20,7 +20,7 @@ func testNetwork(networkType string, t *testing.T) {
bnw, _ := types.ParseCIDR("172.16.0.0/24")
br, _ := types.ParseCIDR("172.16.0.1/16")
netOption := make(map[string]interface{})
netOption := make(map[string]any)
networkOptions := map[string]string{
NetworkName: "TestNetwork",
}
@@ -44,7 +44,7 @@ func testNetwork(networkType string, t *testing.T) {
}
}()
epOptions := make(map[string]interface{})
epOptions := make(map[string]any)
te := &testEndpoint{}
err = d.CreateEndpoint(context.TODO(), "dummy", "ep1", te.Interface(), epOptions)
if err != nil {

View File

@@ -5,6 +5,6 @@ import (
"github.com/moby/moby/v2/daemon/libnetwork/drivers/null"
)
func registerNetworkDrivers(r driverapi.Registerer, driverConfig func(string) map[string]interface{}) error {
func registerNetworkDrivers(r driverapi.Registerer, driverConfig func(string) map[string]any) error {
return null.Register(r)
}

View File

@@ -22,23 +22,23 @@ import (
"github.com/moby/moby/v2/daemon/libnetwork/types"
)
func registerNetworkDrivers(r driverapi.Registerer, store *datastore.Store, pms *drvregistry.PortMappers, driverConfig func(string) map[string]interface{}) error {
func registerNetworkDrivers(r driverapi.Registerer, store *datastore.Store, pms *drvregistry.PortMappers, driverConfig func(string) map[string]any) error {
for _, nr := range []struct {
ntype string
register func(driverapi.Registerer, *datastore.Store, map[string]interface{}) error
register func(driverapi.Registerer, *datastore.Store, map[string]any) error
}{
{ntype: bridge.NetworkType, register: func(r driverapi.Registerer, store *datastore.Store, cfg map[string]interface{}) error {
{ntype: bridge.NetworkType, register: func(r driverapi.Registerer, store *datastore.Store, cfg map[string]any) error {
return bridge.Register(r, store, pms, cfg)
}},
{ntype: host.NetworkType, register: func(r driverapi.Registerer, _ *datastore.Store, _ map[string]interface{}) error {
{ntype: host.NetworkType, register: func(r driverapi.Registerer, _ *datastore.Store, _ map[string]any) error {
return host.Register(r)
}},
{ntype: ipvlan.NetworkType, register: ipvlan.Register},
{ntype: macvlan.NetworkType, register: macvlan.Register},
{ntype: null.NetworkType, register: func(r driverapi.Registerer, _ *datastore.Store, _ map[string]interface{}) error {
{ntype: null.NetworkType, register: func(r driverapi.Registerer, _ *datastore.Store, _ map[string]any) error {
return null.Register(r)
}},
{ntype: overlay.NetworkType, register: func(r driverapi.Registerer, _ *datastore.Store, config map[string]interface{}) error {
{ntype: overlay.NetworkType, register: func(r driverapi.Registerer, _ *datastore.Store, config map[string]any) error {
return overlay.Register(r, config)
}},
} {

View File

@@ -4,6 +4,6 @@ package libnetwork
import "github.com/moby/moby/v2/daemon/libnetwork/driverapi"
func registerNetworkDrivers(r driverapi.Registerer, driverConfig func(string) map[string]interface{}) error {
func registerNetworkDrivers(r driverapi.Registerer, driverConfig func(string) map[string]any) error {
return nil
}

View File

@@ -13,7 +13,7 @@ import (
"github.com/moby/moby/v2/daemon/libnetwork/drvregistry"
)
func registerNetworkDrivers(r driverapi.Registerer, store *datastore.Store, _ *drvregistry.PortMappers, _ func(string) map[string]interface{}) error {
func registerNetworkDrivers(r driverapi.Registerer, store *datastore.Store, _ *drvregistry.PortMappers, _ func(string) map[string]any) error {
for _, nr := range []struct {
ntype string
register func(driverapi.Registerer) error

View File

@@ -52,7 +52,7 @@ type EndpointInterface struct {
}
func (epi *EndpointInterface) MarshalJSON() ([]byte, error) {
epMap := make(map[string]interface{})
epMap := make(map[string]any)
if epi.mac != nil {
epMap["mac"] = epi.mac.String()
}
@@ -86,7 +86,7 @@ func (epi *EndpointInterface) MarshalJSON() ([]byte, error) {
func (epi *EndpointInterface) UnmarshalJSON(b []byte) error {
var (
err error
epMap map[string]interface{}
epMap map[string]any
)
if err = json.Unmarshal(b, &epMap); err != nil {
return err
@@ -107,7 +107,7 @@ func (epi *EndpointInterface) UnmarshalJSON(b []byte) error {
}
}
if v, ok := epMap["llAddrs"]; ok {
list := v.([]interface{})
list := v.([]any)
epi.llAddrs = make([]*net.IPNet, 0, len(list))
for _, llS := range list {
ll, err := types.ParseCIDR(llS.(string))
@@ -456,7 +456,7 @@ func (ep *Endpoint) DisableGatewayService() {
}
func (epj *endpointJoinInfo) MarshalJSON() ([]byte, error) {
epMap := make(map[string]interface{})
epMap := make(map[string]any)
if epj.gw != nil {
epMap["gw"] = epj.gw.String()
}
@@ -471,7 +471,7 @@ func (epj *endpointJoinInfo) MarshalJSON() ([]byte, error) {
func (epj *endpointJoinInfo) UnmarshalJSON(b []byte) error {
var (
err error
epMap map[string]interface{}
epMap map[string]any
)
if err = json.Unmarshal(b, &epMap); err != nil {
return err

View File

@@ -5,7 +5,7 @@ package libnetwork
import "fmt"
// DriverInfo returns a collection of driver operational data related to this endpoint retrieved from the driver.
func (ep *Endpoint) DriverInfo() (map[string]interface{}, error) {
func (ep *Endpoint) DriverInfo() (map[string]any, error) {
ep, err := ep.retrieveFromStore()
if err != nil {
return nil, err

View File

@@ -5,13 +5,13 @@ package libnetwork
import "fmt"
// DriverInfo returns a collection of driver operational data related to this endpoint retrieved from the driver.
func (ep *Endpoint) DriverInfo() (map[string]interface{}, error) {
func (ep *Endpoint) DriverInfo() (map[string]any, error) {
ep, err := ep.retrieveFromStore()
if err != nil {
return nil, err
}
var gwDriverInfo map[string]interface{}
var gwDriverInfo map[string]any
if sb, ok := ep.getSandbox(); ok {
if gwep := sb.getEndpointInGWNetwork(); gwep != nil && gwep.ID() != ep.ID() {

View File

@@ -472,7 +472,7 @@ func (t TableRef) Chain(ctx context.Context, name string) ChainRef {
}
// ChainUpdateFunc is a function that can add rules to a chain, or remove rules from it.
type ChainUpdateFunc func(context.Context, RuleGroup, string, ...interface{}) error
type ChainUpdateFunc func(context.Context, RuleGroup, string, ...any) error
// ChainUpdateFunc returns a [ChainUpdateFunc] to add rules to the named chain if
// enable is true, or to remove rules from the chain if enable is false.
@@ -514,7 +514,7 @@ func (c ChainRef) SetPolicy(policy string) error {
}
// AppendRule appends a rule to a [RuleGroup] in a [ChainRef].
func (c ChainRef) AppendRule(ctx context.Context, group RuleGroup, rule string, args ...interface{}) error {
func (c ChainRef) AppendRule(ctx context.Context, group RuleGroup, rule string, args ...any) error {
if len(args) > 0 {
rule = fmt.Sprintf(rule, args...)
}
@@ -534,7 +534,7 @@ func (c ChainRef) AppendRule(ctx context.Context, group RuleGroup, rule string,
}
// AppendRuleCf calls AppendRule and returns a cleanup function or an error.
func (c ChainRef) AppendRuleCf(ctx context.Context, group RuleGroup, rule string, args ...interface{}) (func(context.Context) error, error) {
func (c ChainRef) AppendRuleCf(ctx context.Context, group RuleGroup, rule string, args ...any) (func(context.Context) error, error) {
if err := c.AppendRule(ctx, group, rule, args...); err != nil {
return nil, err
}
@@ -544,7 +544,7 @@ func (c ChainRef) AppendRuleCf(ctx context.Context, group RuleGroup, rule string
// DeleteRule deletes a rule from a [RuleGroup] in a [ChainRef]. It is an error
// to delete from a group that does not exist, or to delete a rule that does not
// exist.
func (c ChainRef) DeleteRule(ctx context.Context, group RuleGroup, rule string, args ...interface{}) error {
func (c ChainRef) DeleteRule(ctx context.Context, group RuleGroup, rule string, args ...any) error {
if len(args) > 0 {
rule = fmt.Sprintf(rule, args...)
}

View File

@@ -87,7 +87,7 @@ func getPluginClient(p plugingetter.CompatPlugin) (*plugins.Client, error) {
return client, nil
}
func (a *allocator) call(methodName string, arg interface{}, retVal PluginResponse) error {
func (a *allocator) call(methodName string, arg any, retVal PluginResponse) error {
method := ipamapi.PluginEndpointType + "." + methodName
err := a.endpoint.Call(method, arg, retVal)
if err != nil {

View File

@@ -19,9 +19,9 @@ import (
is "gotest.tools/v3/assert/cmp"
)
func handle(t *testing.T, mux *http.ServeMux, method string, h func(map[string]interface{}) interface{}) {
func handle(t *testing.T, mux *http.ServeMux, method string, h func(map[string]any) any) {
mux.HandleFunc(fmt.Sprintf("/%s.%s", ipamapi.PluginEndpointType, method), func(w http.ResponseWriter, r *http.Request) {
var ask map[string]interface{}
var ask map[string]any
err := json.NewDecoder(r.Body).Decode(&ask)
if err != nil && !errors.Is(err, io.EOF) {
t.Fatal(err)
@@ -78,8 +78,8 @@ func TestGetCapabilities(t *testing.T) {
mux := http.NewServeMux()
defer setupPlugin(t, plugin, mux)()
handle(t, mux, "GetCapabilities", func(msg map[string]interface{}) interface{} {
return map[string]interface{}{
handle(t, mux, "GetCapabilities", func(msg map[string]any) any {
return map[string]any{
"RequiresMACAddress": true,
}
})
@@ -134,8 +134,8 @@ func TestGetDefaultAddressSpaces(t *testing.T) {
mux := http.NewServeMux()
defer setupPlugin(t, plugin, mux)()
handle(t, mux, "GetDefaultAddressSpaces", func(msg map[string]interface{}) interface{} {
return map[string]interface{}{
handle(t, mux, "GetDefaultAddressSpaces", func(msg map[string]any) any {
return map[string]any{
"LocalDefaultAddressSpace": "white",
"GlobalDefaultAddressSpace": "blue",
}
@@ -168,14 +168,14 @@ func TestRemoteDriver(t *testing.T) {
mux := http.NewServeMux()
defer setupPlugin(t, plugin, mux)()
handle(t, mux, "GetDefaultAddressSpaces", func(msg map[string]interface{}) interface{} {
return map[string]interface{}{
handle(t, mux, "GetDefaultAddressSpaces", func(msg map[string]any) any {
return map[string]any{
"LocalDefaultAddressSpace": "white",
"GlobalDefaultAddressSpace": "blue",
}
})
handle(t, mux, "RequestPool", func(msg map[string]interface{}) interface{} {
handle(t, mux, "RequestPool", func(msg map[string]any) any {
as := "white"
if v, ok := msg["AddressSpace"]; ok && v.(string) != "" {
as = v.(string)
@@ -193,21 +193,21 @@ func TestRemoteDriver(t *testing.T) {
if sp != "" {
pid = fmt.Sprintf("%s/%s", pid, sp)
}
return map[string]interface{}{
return map[string]any{
"PoolID": pid,
"Pool": pl,
"Data": map[string]string{"DNS": "8.8.8.8"},
}
})
handle(t, mux, "ReleasePool", func(msg map[string]interface{}) interface{} {
handle(t, mux, "ReleasePool", func(msg map[string]any) any {
if _, ok := msg["PoolID"]; !ok {
t.Fatal("Missing PoolID in Release request")
}
return map[string]interface{}{}
return map[string]any{}
})
handle(t, mux, "RequestAddress", func(msg map[string]interface{}) interface{} {
handle(t, mux, "RequestAddress", func(msg map[string]any) any {
if _, ok := msg["PoolID"]; !ok {
t.Fatal("Missing PoolID in address request")
}
@@ -220,19 +220,19 @@ func TestRemoteDriver(t *testing.T) {
ip = "172.20.0.34"
}
ip = fmt.Sprintf("%s/16", ip)
return map[string]interface{}{
return map[string]any{
"Address": ip,
}
})
handle(t, mux, "ReleaseAddress", func(msg map[string]interface{}) interface{} {
handle(t, mux, "ReleaseAddress", func(msg map[string]any) any {
if _, ok := msg["PoolID"]; !ok {
t.Fatal("Missing PoolID in address request")
}
if _, ok := msg["Address"]; !ok {
t.Fatal("Missing Address in release address request")
}
return map[string]interface{}{}
return map[string]any{}
})
p, err := plugins.Get(plugin, ipamapi.PluginEndpointType)

View File

@@ -132,7 +132,7 @@ func signalHandler() {
}
}
func dbusConnectionChanged(args []interface{}) {
func dbusConnectionChanged(args []any) {
name := args[0].(string)
oldOwner := args[1].(string)
newOwner := args[2].(string)
@@ -206,15 +206,15 @@ type firewalldZone struct {
unused bool
target string
services []string
ports [][]interface{}
ports [][]any
icmpBlocks []string
masquerade bool
forwardPorts [][]interface{}
forwardPorts [][]any
interfaces []string
sourceAddresses []string
richRules []string
protocols []string
sourcePorts [][]interface{}
sourcePorts [][]any
icmpBlockInversion bool
}
@@ -223,8 +223,8 @@ type firewalldZone struct {
// which is deprecated, requires this whole struct. Its replacement, 'addZone2'
// (introduced in firewalld 0.9.0) accepts a dictionary where only non-default
// values need to be specified.
func (z firewalldZone) settings() []interface{} {
return []interface{}{
func (z firewalldZone) settings() []any {
return []any{
z.version,
z.name,
z.description,
@@ -276,7 +276,7 @@ func setupDockerZone() (bool, error) {
// The bool return value is true if a firewalld reload is required.
func setupDockerForwardingPolicy() (bool, error) {
// https://firewalld.org/documentation/man-pages/firewalld.dbus.html#FirewallD1.config
policy := map[string]interface{}{
policy := map[string]any{
"version": "1.0",
"description": "allow forwarding to the docker zone",
"ingress_zones": []string{"ANY"},

View File

@@ -785,7 +785,7 @@ func badDriverRegister(reg driverapi.Registerer) error {
return reg.RegisterDriver(badDriverName, &bd, driverapi.Capability{DataScope: scope.Local})
}
func (b *badDriver) CreateNetwork(ctx context.Context, nid string, options map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
func (b *badDriver) CreateNetwork(ctx context.Context, nid string, options map[string]any, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
if b.failNetworkCreation {
return errors.New("I will not create any network")
}
@@ -796,7 +796,7 @@ func (b *badDriver) DeleteNetwork(nid string) error {
return nil
}
func (b *badDriver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, options map[string]interface{}) error {
func (b *badDriver) CreateEndpoint(_ context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, options map[string]any) error {
return errors.New("I will not create any endpoint")
}
@@ -804,11 +804,11 @@ func (b *badDriver) DeleteEndpoint(nid, eid string) error {
return nil
}
func (b *badDriver) EndpointOperInfo(nid, eid string) (map[string]interface{}, error) {
func (b *badDriver) EndpointOperInfo(nid, eid string) (map[string]any, error) {
return nil, nil
}
func (b *badDriver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, _ map[string]interface{}) error {
func (b *badDriver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, _, _ map[string]any) error {
return errors.New("I will not allow any join")
}

View File

@@ -48,7 +48,7 @@ func newController(t *testing.T) *libnetwork.Controller {
c, err := libnetwork.New(
context.Background(),
config.OptionDataDir(t.TempDir()),
config.OptionDriverConfig(bridgeNetType, map[string]interface{}{
config.OptionDriverConfig(bridgeNetType, map[string]any{
netlabel.GenericData: options.Generic{
"EnableIPForwarding": true,
},
@@ -66,8 +66,8 @@ func createTestNetwork(c *libnetwork.Controller, networkType, networkName string
libnetwork.NetworkOptionIpam(defaultipam.DriverName, "", ipamV4Configs, ipamV6Configs, nil))
}
func getEmptyGenericOption() map[string]interface{} {
return map[string]interface{}{netlabel.GenericData: map[string]string{}}
func getEmptyGenericOption() map[string]any {
return map[string]any{netlabel.GenericData: map[string]string{}}
}
func getPortMapping() []types.PortBinding {

View File

@@ -77,7 +77,7 @@ const (
// GetIfname returns the value associated to the Ifname netlabel from the
// provided options. If there's no Ifname netlabel, or if the value isn't a
// string, it returns an empty string.
func GetIfname(opts map[string]interface{}) string {
func GetIfname(opts map[string]any) string {
ifname, _ := opts[Ifname].(string)
return ifname
}

View File

@@ -9,7 +9,7 @@ import (
func TestGetIfname(t *testing.T) {
testcases := []struct {
name string
opts map[string]interface{}
opts map[string]any
expIfname string
}{
{
@@ -19,33 +19,33 @@ func TestGetIfname(t *testing.T) {
},
{
name: "no ifname",
opts: map[string]interface{}{},
opts: map[string]any{},
expIfname: "",
},
{
name: "ifname set",
opts: map[string]interface{}{
opts: map[string]any{
Ifname: "foobar",
},
expIfname: "foobar",
},
{
name: "ifname set to empty string",
opts: map[string]interface{}{
opts: map[string]any{
Ifname: "",
},
expIfname: "",
},
{
name: "ifname set to nil",
opts: map[string]interface{}{
opts: map[string]any{
Ifname: nil,
},
expIfname: "",
},
{
name: "ifname set to int",
opts: map[string]interface{}{
opts: map[string]any{
Ifname: 42,
},
expIfname: "",

View File

@@ -26,7 +26,7 @@ func encodeRawMessage(t MessageType, raw []byte) ([]byte, error) {
return buf, nil
}
func encodeMessage(t MessageType, msg interface{}) ([]byte, error) {
func encodeMessage(t MessageType, msg any) ([]byte, error) {
buf, err := proto.Marshal(msg.(proto.Message))
if err != nil {
return nil, err

View File

@@ -109,7 +109,7 @@ func OptionUseExternalKey() SandboxOption {
func OptionExposedPorts(exposedPorts []types.TransportPort) SandboxOption {
return func(sb *Sandbox) {
if sb.config.generic == nil {
sb.config.generic = make(map[string]interface{})
sb.config.generic = make(map[string]any)
}
// Defensive copy
eps := make([]types.TransportPort, len(exposedPorts))
@@ -125,7 +125,7 @@ func OptionExposedPorts(exposedPorts []types.TransportPort) SandboxOption {
func OptionPortMapping(portBindings []types.PortBinding) SandboxOption {
return func(sb *Sandbox) {
if sb.config.generic == nil {
sb.config.generic = make(map[string]interface{})
sb.config.generic = make(map[string]any)
}
// Store a copy of the bindings as generic data to pass to the driver
pbs := make([]types.PortBinding, len(portBindings))

View File

@@ -169,7 +169,7 @@ func (sb *Sandbox) storeDelete() error {
}
// sandboxRestore restores Sandbox objects from the store, deleting them if they're not active.
func (c *Controller) sandboxRestore(activeSandboxes map[string]interface{}) error {
func (c *Controller) sandboxRestore(activeSandboxes map[string]any) error {
sandboxStates, err := c.store.List(&sbState{c: c})
if err != nil {
if errors.Is(err, datastore.ErrKeyNotFound) {

View File

@@ -13,7 +13,7 @@ func testLocalBackend(t *testing.T, path, bucket string) {
cfgOptions := []config.Option{
config.OptionDataDir(path),
func(c *config.Config) { c.DatastoreBucket = bucket },
config.OptionDriverConfig("host", map[string]interface{}{
config.OptionDriverConfig("host", map[string]any{
netlabel.GenericData: options.Generic{},
}),
}

View File

@@ -415,37 +415,37 @@ type InternalError interface {
******************************/
// InvalidParameterErrorf creates an instance of InvalidParameterError
func InvalidParameterErrorf(format string, params ...interface{}) error {
func InvalidParameterErrorf(format string, params ...any) error {
return errdefs.InvalidParameter(fmt.Errorf(format, params...))
}
// NotFoundErrorf creates an instance of NotFoundError
func NotFoundErrorf(format string, params ...interface{}) error {
func NotFoundErrorf(format string, params ...any) error {
return errdefs.NotFound(fmt.Errorf(format, params...))
}
// ForbiddenErrorf creates an instance of ForbiddenError
func ForbiddenErrorf(format string, params ...interface{}) error {
func ForbiddenErrorf(format string, params ...any) error {
return errdefs.Forbidden(fmt.Errorf(format, params...))
}
// UnavailableErrorf creates an instance of UnavailableError
func UnavailableErrorf(format string, params ...interface{}) error {
func UnavailableErrorf(format string, params ...any) error {
return errdefs.Unavailable(fmt.Errorf(format, params...))
}
// NotImplementedErrorf creates an instance of NotImplementedError
func NotImplementedErrorf(format string, params ...interface{}) error {
func NotImplementedErrorf(format string, params ...any) error {
return errdefs.NotImplemented(fmt.Errorf(format, params...))
}
// InternalErrorf creates an instance of InternalError
func InternalErrorf(format string, params ...interface{}) error {
func InternalErrorf(format string, params ...any) error {
return internal(fmt.Sprintf(format, params...))
}
// InternalMaskableErrorf creates an instance of InternalError and MaskableError
func InternalMaskableErrorf(format string, params ...interface{}) error {
func InternalMaskableErrorf(format string, params ...any) error {
return maskInternal(fmt.Sprintf(format, params...))
}

View File

@@ -56,7 +56,7 @@ func New(info logger.Info) (logger.Logger, error) {
return nil, err
}
extra := map[string]interface{}{
extra := map[string]any{
"_container_id": info.ContainerID,
"_container_name": info.Name(),
"_image_id": info.ContainerImageID,

View File

@@ -25,7 +25,7 @@ const Name = "json-file"
// So let's start with a buffer bigger than this.
const initialBufSize = 256
var buffersPool = sync.Pool{New: func() interface{} { return bytes.NewBuffer(make([]byte, 0, initialBufSize)) }}
var buffersPool = sync.Pool{New: func() any { return bytes.NewBuffer(make([]byte, 0, initialBufSize)) }}
// JSONFileLogger is Logger implementation for default Docker logging.
type JSONFileLogger struct {

View File

@@ -38,7 +38,7 @@ func TestJSONLogsMarshalJSONBuf(t *testing.T) {
assert.NilError(t, err)
assert.Assert(t, regexP(buf.String(), expression))
assert.NilError(t, json.Unmarshal(buf.Bytes(), &map[string]interface{}{}))
assert.NilError(t, json.Unmarshal(buf.Bytes(), &map[string]any{}))
}
}

View File

@@ -30,7 +30,7 @@ const (
defaultCompressLogs = true
)
var buffersPool = sync.Pool{New: func() interface{} {
var buffersPool = sync.Pool{New: func() any {
b := make([]byte, initialBufSize)
return &b
}}

Some files were not shown because too many files have changed in this diff Show More