Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added lint job #30

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
moberghammer marked this conversation as resolved.
Show resolved Hide resolved

- name: Build
run: go build -v .

Expand Down
1 change: 0 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func init() {

func getList() ([]byte, error) {
output, err := exec.Command(commandName, commandArguments...).Output()

if err != nil {
return nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion todo.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package main

import (
"fmt"
"github.com/cego/zfs-cleaner/zfs"
"os/exec"
"strings"

"github.com/cego/zfs-cleaner/zfs"
)

type (
Expand Down
6 changes: 2 additions & 4 deletions zfs/Snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 10 additions & 5 deletions zfs/SnapshotList_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down