From e677800ca48cb22e1f8881468d399c3ed36d220e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 7 Aug 2024 16:12:39 +0200 Subject: [PATCH] Bump Go version in go.mod and fix staticcheck errors --- gen/main.go | 6 ++---- go.mod | 2 +- libwebp/encode_test.go | 9 +++------ 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/gen/main.go b/gen/main.go index f67d20c..7f52921 100644 --- a/gen/main.go +++ b/gen/main.go @@ -4,7 +4,6 @@ package main import ( "fmt" - "io/ioutil" "log" "os" "path" @@ -30,7 +29,7 @@ func main() { // directory. // // The custom bindings are named with a "a__" prefix. Keep those. - fis, err := ioutil.ReadDir(dstDir) + fis, err := os.ReadDir(dstDir) if err != nil { log.Fatal(err) } @@ -61,7 +60,7 @@ func main() { filename = strings.TrimPrefix(filename, "/") target := filepath.Join(dstDir, fi.Name()) - if err := ioutil.WriteFile(target, []byte(fmt.Sprintf(`#ifndef LIBWEBP_NO_SRC + if err := os.WriteFile(target, []byte(fmt.Sprintf(`#ifndef LIBWEBP_NO_SRC #include "../../libwebp_src/%s" #endif `, filename)), 0o644); err != nil { @@ -70,7 +69,6 @@ func main() { return nil }) - if err != nil { log.Fatal(err) } diff --git a/go.mod b/go.mod index 019b8a5..97246e2 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ module github.com/bep/gowebp -go 1.16 +go 1.20 require golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb // indirect diff --git a/libwebp/encode_test.go b/libwebp/encode_test.go index 4e7dee0..7ef277b 100644 --- a/libwebp/encode_test.go +++ b/libwebp/encode_test.go @@ -6,10 +6,7 @@ import ( "image" "image/draw" "image/jpeg" - _ "image/jpeg" - _ "image/png" "io" - "io/ioutil" "os" "path/filepath" "runtime" @@ -108,7 +105,7 @@ func TestEncodeLongRunning(t *testing.T) { t.Fatal(err) } - if err = Encode(ioutil.Discard, img, test.opts); err != nil { + if err = Encode(io.Discard, img, test.opts); err != nil { t.Fatal(err) } } @@ -138,7 +135,7 @@ func BenchmarkEncode(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { - if err = Encode(ioutil.Discard, imgrgba, test.opts); err != nil { + if err = Encode(io.Discard, imgrgba, test.opts); err != nil { b.Fatal(err) } } @@ -163,7 +160,7 @@ func BenchmarkEncodeJpeg(b *testing.B) { } for i := 0; i < b.N; i++ { - if err = jpeg.Encode(ioutil.Discard, img, opts); err != nil { + if err = jpeg.Encode(io.Discard, img, opts); err != nil { b.Fatal(err) } }