Skip to content

Commit 6c5aadf

Browse files
committed
Replace ioutil by os
1 parent fe72ea2 commit 6c5aadf

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

config.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package config
33
import (
44
"fmt"
55
"github.com/spf13/viper"
6-
"io/ioutil"
76
"log"
87
"os"
98
"reflect"
@@ -214,15 +213,15 @@ func LoadFileWithPath(parentPath string, directory string, env string, filename
214213
file = "./" + parentPath + "/" + directory + "/" + filename[0:indexDot] + "-" + env + filename[indexDot:]
215214
}
216215
if fileExists(file) {
217-
return ioutil.ReadFile(file)
216+
return os.ReadFile(file)
218217
}
219218
}
220219
}
221220
file := "./" + directory + "/" + filename
222221
if !fileExists(file) {
223222
file = "./" + parentPath + "/" + directory + "/" + filename
224223
}
225-
return ioutil.ReadFile(file)
224+
return os.ReadFile(file)
226225
} else {
227226
if len(env) > 0 {
228227
indexDot := strings.LastIndex(filename, ".")
@@ -232,15 +231,15 @@ func LoadFileWithPath(parentPath string, directory string, env string, filename
232231
file = "./" + parentPath + "/" + filename[0:indexDot] + "-" + env + filename[indexDot:]
233232
}
234233
if fileExists(file) {
235-
return ioutil.ReadFile(file)
234+
return os.ReadFile(file)
236235
}
237236
}
238237
}
239238
file := "./" + filename
240239
if !fileExists(file) {
241240
file = "./" + parentPath + "/" + filename
242241
}
243-
return ioutil.ReadFile(file)
242+
return os.ReadFile(file)
244243
}
245244
}
246245
func LoadFileWithEnv(env string, filename string) ([]byte, error) {

0 commit comments

Comments
 (0)