mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Handle ioutil deprecations (#53526)
* replace ioutil.ReadFile -> os.ReadFile * replace ioutil.ReadAll -> io.ReadAll * replace ioutil.TempFile -> os.CreateTemp * replace ioutil.NopCloser -> io.NopCloser * replace ioutil.WriteFile -> os.WriteFile * replace ioutil.TempDir -> os.MkdirTemp * replace ioutil.Discard -> io.Discard
This commit is contained in:
@@ -3,11 +3,11 @@ package main
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/getkin/kin-openapi/openapi2"
|
||||
"github.com/getkin/kin-openapi/openapi2conv"
|
||||
"github.com/getkin/kin-openapi/openapi3"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
// main This simple script will take the swagger v2 spec generated by grafana and convert them into openapi 3
|
||||
@@ -30,7 +30,7 @@ func main() {
|
||||
}
|
||||
|
||||
fmt.Printf("Reading swagger 2 file %s\n", inFile)
|
||||
byt, err := ioutil.ReadFile(inFile)
|
||||
byt, err := os.ReadFile(inFile)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -54,7 +54,7 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err = ioutil.WriteFile(outFile, j3, 0644); err != nil {
|
||||
if err = os.WriteFile(outFile, j3, 0644); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Printf("OpenAPI specs generated in file %s\n", outFile)
|
||||
|
||||
Reference in New Issue
Block a user