add deps to makefile fix gitignore remove deprecated ioutil #3

Merged
abs3nt merged 8 commits from a into main 2023-01-19 05:26:32 +00:00
Showing only changes of commit 55d4a4de5b - Show all commits

View File

@ -3,6 +3,7 @@ package auth
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io"
"io/ioutil" "io/ioutil"
"log" "log"
"net/http" "net/http"
@ -63,7 +64,7 @@ func GetClient(ctx *gctx.Context) (*spotify.Client, error) {
return nil, err return nil, err
} }
defer authFile.Close() defer authFile.Close()
authValue, err := ioutil.ReadAll(authFile) authValue, err := io.ReadAll(authFile)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -82,7 +83,7 @@ func GetClient(ctx *gctx.Context) (*spotify.Client, error) {
if err != nil { if err != nil {
panic(err.Error()) panic(err.Error())
} }
err = ioutil.WriteFile(filepath.Join(configDir, "gospt/auth.json"), out, 0o644) err = os.WriteFile(filepath.Join(configDir, "gospt/auth.json"), out, 0o644)
if err != nil { if err != nil {
panic("FAILED TO SAVE AUTH") panic("FAILED TO SAVE AUTH")
} }
@ -91,7 +92,7 @@ func GetClient(ctx *gctx.Context) (*spotify.Client, error) {
if err != nil { if err != nil {
panic(err.Error()) panic(err.Error())
} }
err = ioutil.WriteFile(filepath.Join(configDir, "gospt/auth.json"), out, 0o644) err = os.WriteFile(filepath.Join(configDir, "gospt/auth.json"), out, 0o644)
if err != nil { if err != nil {
panic("FAILED TO SAVE AUTH") panic("FAILED TO SAVE AUTH")
} }