This commit is contained in:
Jeremy Facchetti 2022-09-28 10:05:00 +02:00 коммит произвёл Mikalai Radchuk
Родитель 9e842a962d
Коммит ba5209db6c
9 изменённых файлов: 31 добавлений и 37 удалений

Просмотреть файл

@ -10,10 +10,10 @@ import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
"os"
"time"
"github.com/gorilla/mux"
@ -38,12 +38,12 @@ func run(ctx context.Context, l *logrus.Entry) error {
flag.Parse()
cert, err := ioutil.ReadFile(*certFile)
cert, err := os.ReadFile(*certFile)
if err != nil {
panic(err)
}
b, err := ioutil.ReadFile(*keyFile)
b, err := os.ReadFile(*keyFile)
if err != nil {
panic(err)
}

Просмотреть файл

@ -5,7 +5,6 @@ package main
import (
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"sort"
@ -53,7 +52,7 @@ func canonicalizeAssets() error {
}
func formatServerGroups(path string) error {
b, err := ioutil.ReadFile(path)
b, err := os.ReadFile(path)
if err != nil {
return err
}
@ -70,11 +69,11 @@ func formatServerGroups(path string) error {
return err
}
return ioutil.WriteFile(path, append(b, '\n'), 0666)
return os.WriteFile(path, append(b, '\n'), 0666)
}
func canonicalizeServerResources(path string) error {
b, err := ioutil.ReadFile(path)
b, err := os.ReadFile(path)
if err != nil {
return err
}
@ -101,5 +100,5 @@ func canonicalizeServerResources(path string) error {
return err
}
return ioutil.WriteFile(path, append(b, '\n'), 0666)
return os.WriteFile(path, append(b, '\n'), 0666)
}

Просмотреть файл

@ -5,7 +5,6 @@ package main
import (
"context"
"io/ioutil"
"os"
"path/filepath"
@ -61,7 +60,7 @@ func writeVersion(ctx context.Context, restconfig *rest.Config) error {
}
versionPath := filepath.Join(discoveryCacheDir, "assets_version")
return ioutil.WriteFile(versionPath, []byte(clusterVersion.String()+"\n"), 0666)
return os.WriteFile(versionPath, []byte(clusterVersion.String()+"\n"), 0666)
}
func main() {

Просмотреть файл

@ -10,7 +10,6 @@ import (
"encoding/pem"
"flag"
"fmt"
"io/ioutil"
"os"
utiltls "github.com/Azure/ARO-RP/pkg/util/tls"
@ -28,7 +27,7 @@ func run(name string) error {
var signingCert *x509.Certificate
if *keyFile != "" {
b, err := ioutil.ReadFile(*keyFile)
b, err := os.ReadFile(*keyFile)
if err != nil {
return err
}
@ -40,7 +39,7 @@ func run(name string) error {
}
if *certFile != "" {
b, err := ioutil.ReadFile(*certFile)
b, err := os.ReadFile(*certFile)
if err != nil {
return err
}
@ -57,13 +56,13 @@ func run(name string) error {
}
// key in der format
err = ioutil.WriteFile(name+".key", x509.MarshalPKCS1PrivateKey(key), 0600)
err = os.WriteFile(name+".key", x509.MarshalPKCS1PrivateKey(key), 0600)
if err != nil {
return err
}
// cert in der format
err = ioutil.WriteFile(name+".crt", cert[0].Raw, 0666)
err = os.WriteFile(name+".crt", cert[0].Raw, 0666)
if err != nil {
return err
}
@ -85,7 +84,7 @@ func run(name string) error {
}
// key and cert in PKCS#8 PEM format for Azure Key Vault.
return ioutil.WriteFile(name+".pem", buf.Bytes(), 0600)
return os.WriteFile(name+".pem", buf.Bytes(), 0600)
}
func usage() {

Просмотреть файл

@ -8,7 +8,6 @@ import (
"errors"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
@ -67,7 +66,7 @@ func applyGoLicense() error {
return nil
}
b, err := ioutil.ReadFile(path)
b, err := os.ReadFile(path)
if err != nil {
return err
}
@ -86,7 +85,7 @@ func applyGoLicense() error {
bb = append(bb, goLicense...)
bb = append(bb, b[i:]...)
err = ioutil.WriteFile(path, bb, 0666)
err = os.WriteFile(path, bb, 0666)
if err != nil {
return err
}
@ -115,7 +114,7 @@ func applyPythonLicense() error {
return nil
}
b, err := ioutil.ReadFile(path)
b, err := os.ReadFile(path)
if err != nil {
return err
}
@ -136,7 +135,7 @@ func applyPythonLicense() error {
bb = append(bb, b...)
}
err = ioutil.WriteFile(path, bb, 0666)
err = os.WriteFile(path, bb, 0666)
if err != nil {
return err
}
@ -146,7 +145,7 @@ func applyPythonLicense() error {
})
}
//returns the lists of files that don't have a license but should
// returns the lists of files that don't have a license but should
func validateGoLicenses(ignored map[string]bool, dirs []string) []string {
unlicensedFiles := make([]string, 0)
for _, dir := range dirs {
@ -163,7 +162,7 @@ func validateGoLicenses(ignored map[string]bool, dirs []string) []string {
return nil
}
b, err := ioutil.ReadFile(path)
b, err := os.ReadFile(path)
if err != nil {
return err
}
@ -182,7 +181,7 @@ func validateGoLicenses(ignored map[string]bool, dirs []string) []string {
return unlicensedFiles
}
//returns the lists of files that don't have a license but should
// returns the lists of files that don't have a license but should
func validatePythonLicenses(ignored map[string]bool, dirs []string) []string {
unlicensedFiles := make([]string, 0)
@ -204,7 +203,7 @@ func validatePythonLicenses(ignored map[string]bool, dirs []string) []string {
return nil
}
b, err := ioutil.ReadFile(path)
b, err := os.ReadFile(path)
if err != nil {
return err
}

Просмотреть файл

@ -10,7 +10,6 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"net"
"os"
@ -48,7 +47,7 @@ func run(ctx context.Context, log *logrus.Entry) error {
return fmt.Errorf("usage: %s IP", os.Args[0])
}
certb, err := ioutil.ReadFile(*certFile)
certb, err := os.ReadFile(*certFile)
if err != nil {
return err
}
@ -61,7 +60,7 @@ func run(ctx context.Context, log *logrus.Entry) error {
pool := x509.NewCertPool()
pool.AddCert(cert)
keyb, err := ioutil.ReadFile(*keyFile)
keyb, err := os.ReadFile(*keyFile)
if err != nil {
return err
}
@ -71,12 +70,12 @@ func run(ctx context.Context, log *logrus.Entry) error {
return err
}
clientCertb, err := ioutil.ReadFile(*clientCertFile)
clientCertb, err := os.ReadFile(*clientCertFile)
if err != nil {
return err
}
clientKeyb, err := ioutil.ReadFile(*clientKeyFile)
clientKeyb, err := os.ReadFile(*clientKeyFile)
if err != nil {
return err
}

Просмотреть файл

@ -5,7 +5,6 @@ package swagger
import (
"encoding/json"
"io/ioutil"
"os"
"github.com/Azure/ARO-RP/pkg/util/stringutils"
@ -183,7 +182,7 @@ func (g *generator) generateExamples(outputDir string, s *Swagger) error {
b = append(b, '\n')
err = ioutil.WriteFile(outputDir+"/examples/"+op.OperationID+".json", b, 0666)
err = os.WriteFile(outputDir+"/examples/"+op.OperationID+".json", b, 0666)
if err != nil {
return err
}

Просмотреть файл

@ -5,8 +5,8 @@ package swagger
import (
"encoding/json"
"io/ioutil"
"net/http"
"os"
"reflect"
"github.com/Azure/ARO-RP/pkg/util/stringutils"
@ -221,7 +221,7 @@ func Run(api, outputDir string) error {
return err
}
return ioutil.WriteFile(outputDir+"/redhatopenshift.json", b, 0666)
return os.WriteFile(outputDir+"/redhatopenshift.json", b, 0666)
}
func deepCopy(v interface{}) (interface{}, error) {

Просмотреть файл

@ -9,7 +9,7 @@ import (
"crypto/tls"
"encoding/json"
"errors"
"io/ioutil"
"io"
"net/http"
"net/url"
@ -48,7 +48,7 @@ func adminRequest(ctx context.Context, method, path string, params url.Values, i
if err != nil {
return nil, err
}
req.Body = ioutil.NopCloser(buf)
req.Body = io.NopCloser(buf)
req.Header.Set("Content-Type", "application/json")
}
@ -72,7 +72,7 @@ func adminRequest(ctx context.Context, method, path string, params url.Values, i
return resp, json.NewDecoder(resp.Body).Decode(&out)
} else if out != nil && resp.Header.Get("Content-Type") == "text/plain" {
strOut := out.(*string)
p, err := ioutil.ReadAll(resp.Body)
p, err := io.ReadAll(resp.Body)
if err == nil {
*strOut = string(p)
}