Upgrade to Go 1.19

This commit is contained in:
Mikołaj Pęczkowski 2022-12-10 23:47:59 +01:00
parent 2d06e8e09c
commit 741f18efd1
9 changed files with 20 additions and 28 deletions

View file

@ -3,27 +3,27 @@ package app
import (
"errors"
"fmt"
"io/ioutil"
"os"
"strings"
"gitlab.com/revalus/grm/config"
)
func getFileContent(pathToFile string) ([]byte, error) {
return ioutil.ReadFile(pathToFile)
return os.ReadFile(pathToFile)
}
func getFileExcension(pathToFile string) (string, error) {
splittedFileName := strings.Split(pathToFile, ".")
func getFileExtension(pathToFile string) (string, error) {
splitFileName := strings.Split(pathToFile, ".")
if len(splittedFileName) == 1 {
msg := fmt.Sprintf("excension for file \"%v\", not found", splittedFileName)
if len(splitFileName) == 1 {
msg := fmt.Sprintf("excension for file \"%v\", not found", splitFileName)
return "", errors.New(msg)
}
fileExcension := splittedFileName[len(splittedFileName)-1]
fileExtension := splitFileName[len(splitFileName)-1]
return fileExcension, nil
return fileExtension, nil
}
func checkIsItemInSlice(check string, sliceToCheck []string) bool {