convert uses of interface{} to any

Done via:
  find . -name "*.go" | xargs sed -i -E 's/interface\{\}/any/g'

PiperOrigin-RevId: 487033228
This commit is contained in:
Kevin Krakauer
2022-11-08 13:14:06 -08:00
committed by gVisor bot
parent c82b70015d
commit d8aa09e04c
220 changed files with 509 additions and 509 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ type SinkConfig struct {
// Name is the sink to be created. The sink must exist in the system.
Name string `json:"name,omitempty"`
// Config is a opaque json object that is passed to the sink.
Config map[string]interface{} `json:"config,omitempty"`
Config map[string]any `json:"config,omitempty"`
// IgnoreSetupError makes errors during sink setup to be ignored. Otherwise,
// failures will prevent the container from starting.
IgnoreSetupError bool `json:"ignore_setup_error,omitempty"`
+2 -2
View File
@@ -115,11 +115,11 @@ type SinkDesc struct {
// allow the sink to do whatever is necessary to set it up. If it returns a
// file, this file is donated to the sandbox and passed to the sink when New
// is called. config is an opaque json object passed to the sink.
Setup func(config map[string]interface{}) (*os.File, error)
Setup func(config map[string]any) (*os.File, error)
// New creates a new sink. config is an opaque json object passed to the sink.
// endpoing is a file descriptor to the file returned in Setup. It's set to -1
// if Setup returned nil.
New func(config map[string]interface{}, endpoint *fd.FD) (Sink, error)
New func(config map[string]any, endpoint *fd.FD) (Sink, error)
}
// RegisterSink registers a new sink to make it discoverable.
+1 -1
View File
@@ -37,7 +37,7 @@ type null struct {
var _ seccheck.Sink = (*null)(nil)
func new(_ map[string]interface{}, _ *fd.FD) (seccheck.Sink, error) {
func new(_ map[string]any, _ *fd.FD) (seccheck.Sink, error) {
return &null{}, nil
}
+3 -3
View File
@@ -65,7 +65,7 @@ var _ seccheck.Sink = (*remote)(nil)
// setupSink starts the connection to the remote process and returns a file that
// can be used to communicate with it. The caller is responsible to close to
// file.
func setupSink(config map[string]interface{}) (*os.File, error) {
func setupSink(config map[string]any) (*os.File, error) {
addrOpaque, ok := config["endpoint"]
if !ok {
return nil, fmt.Errorf("endpoint not present in configuration")
@@ -133,7 +133,7 @@ func setup(path string) (*os.File, error) {
return f, nil
}
func parseDuration(config map[string]interface{}, name string) (bool, time.Duration, error) {
func parseDuration(config map[string]any, name string) (bool, time.Duration, error) {
opaque, ok := config[name]
if !ok {
return false, 0, nil
@@ -150,7 +150,7 @@ func parseDuration(config map[string]interface{}, name string) (bool, time.Durat
}
// new creates a new Remote sink.
func new(config map[string]interface{}, endpoint *fd.FD) (seccheck.Sink, error) {
func new(config map[string]any, endpoint *fd.FD) (seccheck.Sink, error) {
if endpoint == nil {
return nil, fmt.Errorf("remote sink requires an endpoint")
}
@@ -231,13 +231,13 @@ func TestExample(t *testing.T) {
func TestConfig(t *testing.T) {
for _, tc := range []struct {
name string
config map[string]interface{}
config map[string]any
want *remote
err string
}{
{
name: "default",
config: map[string]interface{}{},
config: map[string]any{},
want: &remote{
retries: 0,
initialBackoff: 25 * time.Microsecond,
@@ -246,7 +246,7 @@ func TestConfig(t *testing.T) {
},
{
name: "all",
config: map[string]interface{}{
config: map[string]any{
"retries": float64(10),
"backoff": "1s",
"backoff_max": "10s",
@@ -259,28 +259,28 @@ func TestConfig(t *testing.T) {
},
{
name: "bad-retries",
config: map[string]interface{}{
config: map[string]any{
"retries": "10",
},
err: "retries",
},
{
name: "bad-backoff",
config: map[string]interface{}{
config: map[string]any{
"backoff": "wrong",
},
err: "invalid duration",
},
{
name: "bad-backoff-max",
config: map[string]interface{}{
config: map[string]any{
"backoff_max": 10,
},
err: "is not an string",
},
{
name: "bad-invalid-backoffs",
config: map[string]interface{}{
config: map[string]any{
"retries": float64(10),
"backoff": "10s",
"backoff_max": "1s",