Skip to content

Commit

Permalink
Release 1.8 CVEs updates (#516)
Browse files Browse the repository at this point in the history
* fixed doc lint for vsphere

* removing ioutil in favor of os and io standar libs

* imported os
  • Loading branch information
gabo1208 authored Feb 28, 2023
1 parent 363be3a commit 189d9a5
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions pkg/horizon/horizon.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"crypto/tls"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"time"

Expand Down Expand Up @@ -74,7 +74,7 @@ func readSecretKey(key string) (string, error) {
mountPath = env.SecretPath
}

data, err := ioutil.ReadFile(filepath.Join(mountPath, key))
data, err := os.ReadFile(filepath.Join(mountPath, key))
if err != nil {
return "", err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/vsphere/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ package vsphere
import (
"context"
"errors"
"io/ioutil"
"net/http"
"net/url"
"os"
"path/filepath"
"time"

Expand Down Expand Up @@ -51,7 +51,7 @@ func ReadKey(key string) (string, error) {
mountPath = env.SecretPath
}

data, err := ioutil.ReadFile(filepath.Join(mountPath, key))
data, err := os.ReadFile(filepath.Join(mountPath, key))
if err != nil {
return "", err
}
Expand Down
6 changes: 4 additions & 2 deletions pkg/vsphere/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ SPDX-License-Identifier: Apache-2.0
// Package vsphere holds utilities for bootstrapping a vSphere API client
// from the metadata injected by the VSphereSource. Within a receive adapter,
// users can create a new vSphere SOAP API client with automatic keep-alive:
// client, err := vsphere.NewSOAPClient(ctx)
//
// client, err := vsphere.NewSOAPClient(ctx)
//
// To properly release vSphere API resources, it is recommended to log out when the client is not needed anymore:
// defer client.Logout(context.Background())
//
// defer client.Logout(context.Background())
//
// This is modeled after the Bindings pattern.
package vsphere
6 changes: 3 additions & 3 deletions plugins/vsphere/pkg/command/auth/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-License-Identifier: Apache-2.0
package auth_test

import (
"io/ioutil"
"io"
"testing"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -45,7 +45,7 @@ func authTestCommand(clientConfig clientcmd.ClientConfig, objects ...runtime.Obj
ClientSet: client,
ClientConfig: clientConfig,
})
cmd.SetErr(ioutil.Discard)
cmd.SetOut(ioutil.Discard)
cmd.SetErr(io.Discard)
cmd.SetOut(io.Discard)
return cmd, client
}
4 changes: 2 additions & 2 deletions plugins/vsphere/pkg/command/auth/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package auth
import (
"context"
"fmt"
"io/ioutil"
"io"
"net/url"
"syscall"

Expand Down Expand Up @@ -136,6 +136,6 @@ func readPassword(cmd *cobra.Command, options *Options) (string, error) {
cmd.Println()
return string(password), err
}
password, err := ioutil.ReadAll(cmd.InOrStdin())
password, err := io.ReadAll(cmd.InOrStdin())
return string(password), err
}
6 changes: 3 additions & 3 deletions plugins/vsphere/pkg/command/binding/binding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-License-Identifier: Apache-2.0
package binding_test

import (
"io/ioutil"
"io"
"testing"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -47,7 +47,7 @@ func bindingTestCommand(clientConfig clientcmd.ClientConfig, objects ...runtime.
ClientConfig: clientConfig,
VSphereClientSet: vSphereSourcesClient,
})
cmd.SetErr(ioutil.Discard)
cmd.SetOut(ioutil.Discard)
cmd.SetErr(io.Discard)
cmd.SetOut(io.Discard)
return cmd, vSphereSourcesClient
}
6 changes: 3 additions & 3 deletions plugins/vsphere/pkg/command/source/source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-License-Identifier: Apache-2.0
package source_test

import (
"io/ioutil"
"io"
"testing"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -47,7 +47,7 @@ func sourceTestCommand(clientConfig clientcmd.ClientConfig, objects ...runtime.O
ClientConfig: clientConfig,
VSphereClientSet: vSphereSourcesClient,
})
cmd.SetErr(ioutil.Discard)
cmd.SetOut(ioutil.Discard)
cmd.SetErr(io.Discard)
cmd.SetOut(io.Discard)
return cmd, vSphereSourcesClient
}

0 comments on commit 189d9a5

Please sign in to comment.