os.ReadFile

This commit is contained in:
BuckarooBanzay 2023-01-20 18:04:27 +01:00
parent a4bd231cec
commit 201d983ac0
5 changed files with 7 additions and 9 deletions

View File

@ -2,7 +2,6 @@ package app
import ( import (
"encoding/json" "encoding/json"
"io/ioutil"
"mapserver/layer" "mapserver/layer"
"os" "os"
"runtime" "runtime"
@ -132,7 +131,7 @@ func ParseConfig(filename string) (*Config, error) {
info, err := os.Stat(filename) info, err := os.Stat(filename)
if info != nil && err == nil { if info != nil && err == nil {
data, err := ioutil.ReadFile(filename) data, err := os.ReadFile(filename)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -19,7 +19,6 @@ import (
"github.com/minetest-go/colormapping" "github.com/minetest-go/colormapping"
"io/ioutil"
"os" "os"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
@ -104,7 +103,7 @@ func Setup(p params.ParamsType, cfg *Config) *App {
if info != nil && err == nil { if info != nil && err == nil {
logrus.WithFields(logrus.Fields{"filename": "colors.txt"}).Info("Loading colors from filesystem") logrus.WithFields(logrus.Fields{"filename": "colors.txt"}).Info("Loading colors from filesystem")
data, err := ioutil.ReadFile("colors.txt") data, err := os.ReadFile("colors.txt")
if err != nil { if err != nil {
panic(err) panic(err)
} }

View File

@ -3,7 +3,7 @@ package areasparser
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"io/ioutil" "os"
) )
type GenericPos struct { type GenericPos struct {
@ -41,7 +41,7 @@ func (pos *GenericPos) UnmarshalJSON(data []byte) error {
} }
func ParseFile(filename string) ([]*Area, error) { func ParseFile(filename string) ([]*Area, error) {
content, err := ioutil.ReadFile(filename) content, err := os.ReadFile(filename)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -46,7 +46,7 @@ func (this *TileDB) GetTile(pos *coords.TileCoords) ([]byte, error) {
_, file := this.getDirAndFile(pos) _, file := this.getDirAndFile(pos)
info, _ := os.Stat(file) info, _ := os.Stat(file)
if info != nil { if info != nil {
content, err := ioutil.ReadFile(file) content, err := os.ReadFile(file)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View File

@ -3,8 +3,8 @@ package travelnetparser
import ( import (
"errors" "errors"
"fmt" "fmt"
"io/ioutil"
"mapserver/luaparser" "mapserver/luaparser"
"os"
) )
type GenericPos struct { type GenericPos struct {
@ -19,7 +19,7 @@ type Travelnet struct {
} }
func ParseFile(filename string) (map[string]map[string]map[string]*Travelnet, error) { func ParseFile(filename string) (map[string]map[string]map[string]*Travelnet, error) {
content, err := ioutil.ReadFile(filename) content, err := os.ReadFile(filename)
if err != nil { if err != nil {
return nil, err return nil, err
} }