all: gofmt -w -r 'interface{} -> any' .

Updates #9687
This commit is contained in:
Bjørn Erik Pedersen
2022-03-17 22:03:27 +01:00
parent 423594e03a
commit b80853de90
342 changed files with 2118 additions and 2102 deletions

View File

@@ -53,7 +53,7 @@ type Namespace struct {
// Getenv retrieves the value of the environment variable named by the key.
// It returns the value, which will be empty if the variable is not present.
func (ns *Namespace) Getenv(key interface{}) (string, error) {
func (ns *Namespace) Getenv(key any) (string, error) {
skey, err := cast.ToStringE(key)
if err != nil {
return "", nil
@@ -85,7 +85,7 @@ func readFile(fs afero.Fs, filename string) (string, error) {
// ReadFile reads the file named by filename relative to the configured WorkingDir.
// It returns the contents as a string.
// There is an upper size limit set at 1 megabytes.
func (ns *Namespace) ReadFile(i interface{}) (string, error) {
func (ns *Namespace) ReadFile(i any) (string, error) {
s, err := cast.ToStringE(i)
if err != nil {
return "", err
@@ -99,7 +99,7 @@ func (ns *Namespace) ReadFile(i interface{}) (string, error) {
}
// ReadDir lists the directory contents relative to the configured WorkingDir.
func (ns *Namespace) ReadDir(i interface{}) ([]_os.FileInfo, error) {
func (ns *Namespace) ReadDir(i any) ([]_os.FileInfo, error) {
path, err := cast.ToStringE(i)
if err != nil {
return nil, err
@@ -114,7 +114,7 @@ func (ns *Namespace) ReadDir(i interface{}) ([]_os.FileInfo, error) {
}
// FileExists checks whether a file exists under the given path.
func (ns *Namespace) FileExists(i interface{}) (bool, error) {
func (ns *Namespace) FileExists(i any) (bool, error) {
path, err := cast.ToStringE(i)
if err != nil {
return false, err
@@ -133,7 +133,7 @@ func (ns *Namespace) FileExists(i interface{}) (bool, error) {
}
// Stat returns the os.FileInfo structure describing file.
func (ns *Namespace) Stat(i interface{}) (_os.FileInfo, error) {
func (ns *Namespace) Stat(i any) (_os.FileInfo, error) {
path, err := cast.ToStringE(i)
if err != nil {
return nil, err