io/ioutil
package usage GO-C4001 203 _ = res.Body.Close()
204 }()
205
206 body, err := ioutil.ReadAll(res.Body) 207
208 if err != nil {
209 return []map[string]interface{}{}, 0
846
847// ReadFromYaml read the Config from a YAML file.
848func ReadFromYaml(path string) Config {
849 jsonByte, err := ioutil.ReadFile(path) 850
851 if err != nil {
852 panic(err)
827
828// ReadFromJson read the Config from a JSON file.
829func ReadFromJson(path string) Config {
830 jsonByte, err := ioutil.ReadFile(path) 831
832 if err != nil {
833 panic(err)
17
18 var p ServerLoginParam
19
20 body, err := ioutil.ReadAll(ctx.Request.Body)21
22 if err != nil {
23 logger.Error("get server login parameter error: ", err)
189 defer func() {
190 _ = res.Body.Close()
191 }()
192 body, err := ioutil.ReadAll(res.Body)193 if err != nil {
194 logger.Error("get online plugins: ", err)
195 return nil, err
io/ioutil
package, like most things with util in the name, has turned out to
be a poorly defined and complex to understand the collection of things.
In a series of a few changes, the entire ioutil package will become deprecated starting from Go 1.16.
Existing code using ioutil will continue to work; ioutil will consist of simple wrappers to new functions which reside in the io and os packages.
ioutil.ReadAll(r)
ioutil.ReadFile(filename)
ioutil.ReadDir(dirname)
// ...
io.ReadAll(r)
os.ReadFile(filename)
os.ReadDir(dirname)
// ...