diff --git a/core/index.go b/core/index.go index 3ae34f1..38dc22f 100644 --- a/core/index.go +++ b/core/index.go @@ -4,7 +4,6 @@ import ( "crypto/sha256" "encoding/hex" "io" - "io/ioutil" "os" "path/filepath" "sort" @@ -33,12 +32,8 @@ type IndexFile struct { // LoadIndex attempts to load the index file from a path func LoadIndex(indexFile string, flags Flags) (Index, error) { - data, err := ioutil.ReadFile(indexFile) - if err != nil { - return Index{}, err - } var index Index - if _, err := toml.Decode(string(data), &index); err != nil { + if _, err := toml.DecodeFile(indexFile, &index); err != nil { return Index{}, err } index.flags = flags diff --git a/core/pack.go b/core/pack.go index f80b26a..c3290f0 100644 --- a/core/pack.go +++ b/core/pack.go @@ -3,7 +3,6 @@ import ( "crypto/sha256" "encoding/hex" "io" - "io/ioutil" "os" "path/filepath" @@ -27,12 +26,8 @@ type Pack struct { // LoadPack loads the modpack metadata to a Pack struct func LoadPack(flags Flags) (Pack, error) { - data, err := ioutil.ReadFile(flags.PackFile) - if err != nil { - return Pack{}, err - } var modpack Pack - if _, err := toml.Decode(string(data), &modpack); err != nil { + if _, err := toml.DecodeFile(flags.PackFile, &modpack); err != nil { return Pack{}, err }