diff --git a/contactcard.go b/contactcard.go index 1bd6578..38071d8 100644 --- a/contactcard.go +++ b/contactcard.go @@ -7,7 +7,7 @@ import ( "image" "image/color" "image/png" - "io/ioutil" + "io" "log" "math" "os" @@ -71,7 +71,7 @@ func NewContactCardFromCompressed(compressed []byte) (*ContactCard, error) { if err != nil { return nil, err } - output, err := ioutil.ReadAll(gzreader) + output, err := io.ReadAll(gzreader) if err != nil { return nil, err } @@ -94,7 +94,7 @@ func (contact *ContactCard) WriteCompressed(filename string) error { if err != nil { return err } - err = ioutil.WriteFile(filename, out, 0600) + err = os.WriteFile(filename, out, 0600) if err != nil { return err } diff --git a/endtoend_test.go b/endtoend_test.go index 845e694..3a64d47 100644 --- a/endtoend_test.go +++ b/endtoend_test.go @@ -3,7 +3,7 @@ package meowlib_test import ( "encoding/json" "fmt" - "io/ioutil" + "os" "testing" "forge.redroom.link/yves/meowlib" @@ -74,7 +74,7 @@ func TestEndToEnd(t *testing.T) { } a, _ = json.Marshal(Me) - ioutil.WriteFile("id.json", a, 0644) + os.WriteFile("id.json", a, 0644) fmt.Println(string(a)) ///////////////////////////////////// // Create a message to that friend // diff --git a/message.go b/message.go index ea227af..0efa679 100644 --- a/message.go +++ b/message.go @@ -13,7 +13,7 @@ func (msg *UserMessage) AddFile(filename string, maxMessageSize int64) error { return err } if fi.Size() > maxMessageSize { - return errors.New("Cannot add file, file bigger than messge size") + return errors.New("cannot add file, file bigger than messge size") } var totalsize int64 totalsize = 0 @@ -22,7 +22,7 @@ func (msg *UserMessage) AddFile(filename string, maxMessageSize int64) error { } totalsize += fi.Size() if totalsize > maxMessageSize { - return errors.New("Cannot add file, too many files, max message size exceeded") + return errors.New("cannot add file, too many files, max message size exceeded") } data, err := os.ReadFile(filename) if err != nil { diff --git a/proto_test.go b/proto_test.go index 44b4e07..284824c 100644 --- a/proto_test.go +++ b/proto_test.go @@ -1,8 +1,8 @@ package meowlib_test import ( - "io/ioutil" "log" + "os" "testing" "forge.redroom.link/yves/meowlib" @@ -19,10 +19,10 @@ func TestServerMessageSerialization(t *testing.T) { if err != nil { log.Fatalln("Failed to encode address book:", err) } - if err := ioutil.WriteFile("test", out, 0644); err != nil { + if err := os.WriteFile("test", out, 0644); err != nil { log.Fatalln("Failed to write address book:", err) } - in, err := ioutil.ReadFile("test") + in, err := os.ReadFile("test") if err != nil { log.Fatalln("Error reading file:", err) }