From ed176ca39769545f624fd0d6a06970636bab9a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lesaux?= Date: Fri, 16 Dec 2022 16:14:55 +0100 Subject: [PATCH] add embedded linter in makefile --- common/io.go | 7 +++---- export/impdraw/tile/imp.go | 3 +-- export/ocpartstudio/ocp.go | 3 +-- export/ocpartstudio/window/win.go | 3 +-- gfx/animate/anitmate_test.go | 4 ++-- makefile | 8 +++++++- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/common/io.go b/common/io.go index 2f0f9c5..5e160a4 100644 --- a/common/io.go +++ b/common/io.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/binary" "fmt" - "io/ioutil" "os" "path/filepath" "sort" @@ -16,12 +15,12 @@ func WilcardedFiles(filespath []string) ([]string, error) { for _, v := range filespath { dir := filepath.Dir(v) - fis, err := ioutil.ReadDir(dir) + fis, err := os.ReadDir(dir) if err != nil { return fullfilespath, err } reg := filepath.Base(v) - //fmt.Fprintf(os.Stdout, "Regular to match (%s)\n", reg) + // fmt.Fprintf(os.Stdout, "Regular to match (%s)\n", reg) for _, f := range fis { if !f.IsDir() { check := filepath.Join(dir, f.Name()) @@ -31,7 +30,7 @@ func WilcardedFiles(filespath []string) ([]string, error) { fmt.Fprintf(os.Stderr, "Error while checking match with error %v\n", err) return fullfilespath, err } - //fmt.Fprintf(os.Stdout, "Returns %v\n", matchs) + // fmt.Fprintf(os.Stdout, "Returns %v\n", matchs) if matchs { // fmt.Fprintf(os.Stdout, "Ok (%s) matches (%s)\n", reg, check) if !ContainsFilepath(fullfilespath, check) { diff --git a/export/impdraw/tile/imp.go b/export/impdraw/tile/imp.go index feb6fa5..85376a7 100644 --- a/export/impdraw/tile/imp.go +++ b/export/impdraw/tile/imp.go @@ -6,7 +6,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "os" "path/filepath" @@ -96,7 +95,7 @@ func RawImp(filePath string) ([]byte, error) { } } - bf, err := ioutil.ReadAll(fr) + bf, err := io.ReadAll(fr) if err != nil { return nil, err } diff --git a/export/ocpartstudio/ocp.go b/export/ocpartstudio/ocp.go index bab576f..8ecb99f 100644 --- a/export/ocpartstudio/ocp.go +++ b/export/ocpartstudio/ocp.go @@ -5,7 +5,6 @@ import ( "fmt" "image/color" "io" - "io/ioutil" "os" "github.com/jeromelesaux/m4client/cpc" @@ -164,7 +163,7 @@ func RawScr(filePath string) ([]byte, error) { } } - bf, err := ioutil.ReadAll(fr) + bf, err := io.ReadAll(fr) if err != nil { return nil, err } diff --git a/export/ocpartstudio/window/win.go b/export/ocpartstudio/window/win.go index 4ef03f0..5b32352 100644 --- a/export/ocpartstudio/window/win.go +++ b/export/ocpartstudio/window/win.go @@ -4,7 +4,6 @@ import ( "encoding/binary" "fmt" "io" - "io/ioutil" "os" "github.com/jeromelesaux/m4client/cpc" @@ -48,7 +47,7 @@ func RawWin(filePath string) ([]byte, error) { } } - bf, err := ioutil.ReadAll(fr) + bf, err := io.ReadAll(fr) if err != nil { return nil, err } diff --git a/gfx/animate/anitmate_test.go b/gfx/animate/anitmate_test.go index b23376e..4d1da77 100644 --- a/gfx/animate/anitmate_test.go +++ b/gfx/animate/anitmate_test.go @@ -6,7 +6,7 @@ import ( "image/draw" "image/gif" "image/png" - "io/ioutil" + "io" "os" "testing" @@ -41,7 +41,7 @@ func TestCompressZx0(t *testing.T) { t.Fatalf("%v", err) } defer f.Close() - b, err := ioutil.ReadAll(f) + b, err := io.ReadAll(f) if err != nil { t.Fatalf("%v", err) } diff --git a/makefile b/makefile index 2918650..2ac393b 100644 --- a/makefile +++ b/makefile @@ -120,4 +120,10 @@ package-linux: fyne package -os linux -icon martine-logo.png -sourceDir ${SOURCEDIR} -name martine mv martine ${BINARY}/martine-${OS}-${ARCH}/ (make archive) - \ No newline at end of file + +get-linter: + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1 + +lint: + @echo "Lint the whole project" + golangci-lint run --timeout 2m