From 32b9af36422dd7e82cc37c82876dbd4cb8cfd3dc Mon Sep 17 00:00:00 2001 From: Carsten Moberg Hammer Date: Tue, 27 Oct 2020 11:42:18 +0100 Subject: [PATCH 1/5] Added lint job --- .github/workflows/go.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f5b3754..6665f8a 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -24,6 +24,11 @@ jobs: - name: Get dependencies run: go mod download + - name: Lint code + uses: golangci/golangci-lint-action@v2 + with: + version: v1.29 + - name: Build run: go build -v . From a99e7e075242b238720e2d234ad485663319fb48 Mon Sep 17 00:00:00 2001 From: Carsten Moberg Hammer Date: Wed, 28 Oct 2020 13:42:04 +0100 Subject: [PATCH 2/5] formattet with gofumpt --- main.go | 1 - todo.go | 3 ++- zfs/Snapshot.go | 6 ++---- zfs/SnapshotList_test.go | 15 ++++++++++----- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/main.go b/main.go index 00e6b05..909740c 100644 --- a/main.go +++ b/main.go @@ -50,7 +50,6 @@ func init() { func getList() ([]byte, error) { output, err := exec.Command(commandName, commandArguments...).Output() - if err != nil { return nil, err } diff --git a/todo.go b/todo.go index ddb85b7..c7000ca 100644 --- a/todo.go +++ b/todo.go @@ -2,9 +2,10 @@ package main import ( "fmt" - "github.com/cego/zfs-cleaner/zfs" "os/exec" "strings" + + "github.com/cego/zfs-cleaner/zfs" ) type ( diff --git a/zfs/Snapshot.go b/zfs/Snapshot.go index f864619..caefa11 100644 --- a/zfs/Snapshot.go +++ b/zfs/Snapshot.go @@ -17,10 +17,8 @@ type ( } ) -var ( - // ErrMalformedLine will be returned if output from zfs is unusable. - ErrMalformedLine = errors.New("broken line") -) +// ErrMalformedLine will be returned if output from zfs is unusable. +var ErrMalformedLine = errors.New("broken line") // NewSnapshotFromLine will try to parse a line from "zfs list" and instantiate // a new Snapshot. diff --git a/zfs/SnapshotList_test.go b/zfs/SnapshotList_test.go index 67fedfe..d6d0bea 100644 --- a/zfs/SnapshotList_test.go +++ b/zfs/SnapshotList_test.go @@ -226,27 +226,32 @@ func TestSieve(t *testing.T) { true, true, true, true, true, true, true, true, true, true, false, true, true, true, true, - true, true}}, + true, true, + }}, {time.Unix(0, 0), 5 * time.Second, []bool{ true, true, true, true, true, false, true, true, true, false, false, true, true, false, true, - true, true}}, + true, true, + }}, {time.Unix(0, 0), 10 * time.Second, []bool{ true, false, true, false, true, false, false, true, false, false, false, true, false, false, true, - false, true}}, + false, true, + }}, {time.Unix(0, 0), 100 * time.Second, []bool{ true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, - false, false}}, + false, false, + }}, {time.Unix(0, 0), 100000000 * time.Second, []bool{ true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, - false, false}}, + false, false, + }}, } for i, c := range cases { From 8195643d24d430038f287303244fee1a12a0b4f7 Mon Sep 17 00:00:00 2001 From: Carsten Moberg Hammer Date: Wed, 28 Oct 2020 13:54:54 +0100 Subject: [PATCH 3/5] Update .github/workflows/go.yml Co-authored-by: Anders Brander --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 6665f8a..b093dcb 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -27,7 +27,7 @@ jobs: - name: Lint code uses: golangci/golangci-lint-action@v2 with: - version: v1.29 + version: v1.32 - name: Build run: go build -v . From cd4e1f8c1d6aea33351de24c2009633272ea5100 Mon Sep 17 00:00:00 2001 From: Carsten Moberg Hammer Date: Thu, 29 Oct 2020 07:38:28 +0100 Subject: [PATCH 4/5] Moved lint task --- .github/workflows/go.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index b093dcb..d8fa845 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -21,14 +21,14 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@v2 - - name: Get dependencies - run: go mod download - - name: Lint code uses: golangci/golangci-lint-action@v2 with: version: v1.32 + - name: Get dependencies + run: go mod download + - name: Build run: go build -v . From 9ad3c79dfcef0f15bad9b5d5d743af3b295ba2d0 Mon Sep 17 00:00:00 2001 From: Carsten Moberg Hammer Date: Mon, 11 Mar 2024 15:48:33 +0100 Subject: [PATCH 5/5] Update .github/workflows/go.yml --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d8fa845..515a645 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -24,7 +24,7 @@ jobs: - name: Lint code uses: golangci/golangci-lint-action@v2 with: - version: v1.32 + version: v4.0.0 - name: Get dependencies run: go mod download