deprecations

This commit is contained in:
ycc 2022-12-19 12:15:10 +01:00
parent bf901a7aa3
commit c6ec65f3fa
4 changed files with 10 additions and 10 deletions

View File

@ -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
}

View File

@ -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 //

View File

@ -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 {

View File

@ -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)
}