diff --git a/.golangci.yml b/.golangci.yml index 19d45198b3..fec3baa882 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -5,12 +5,23 @@ linters: enable: + - depguard - goimports - gofmt - gofumpt - misspell linters-settings: + depguard: + rules: + main: + files: + - "$all" + - "!$test" + - "!**/errors/*.go" + deny: + - pkg: "errors" + desc: "Use github.com/go-task/task/v3/errors instead" goimports: local-prefixes: github.com/go-task gofmt: diff --git a/cmd/release/main.go b/cmd/release/main.go index efccff9e53..dfe0960a01 100644 --- a/cmd/release/main.go +++ b/cmd/release/main.go @@ -1,7 +1,6 @@ package main import ( - "errors" "fmt" "os" "os/exec" @@ -12,6 +11,8 @@ import ( "github.com/Masterminds/semver/v3" "github.com/otiai10/copy" "github.com/spf13/pflag" + + "github.com/go-task/task/v3/errors" ) const ( diff --git a/internal/execext/exec.go b/internal/execext/exec.go index 69ab8865f3..1de964e76d 100644 --- a/internal/execext/exec.go +++ b/internal/execext/exec.go @@ -2,7 +2,6 @@ package execext import ( "context" - "errors" "fmt" "io" "os" @@ -14,6 +13,8 @@ import ( "mvdan.cc/sh/v3/interp" "mvdan.cc/sh/v3/shell" "mvdan.cc/sh/v3/syntax" + + "github.com/go-task/task/v3/errors" ) // RunCommandOptions is the options for the RunCommand func diff --git a/internal/flags/flags.go b/internal/flags/flags.go index cf884fe091..58762c405d 100644 --- a/internal/flags/flags.go +++ b/internal/flags/flags.go @@ -2,7 +2,6 @@ package flags import ( "cmp" - "errors" "log" "os" "strconv" @@ -10,6 +9,7 @@ import ( "github.com/spf13/pflag" + "github.com/go-task/task/v3/errors" "github.com/go-task/task/v3/internal/experiments" "github.com/go-task/task/v3/taskfile/ast" ) diff --git a/precondition.go b/precondition.go index 3ae9ad0466..1f25bd37f5 100644 --- a/precondition.go +++ b/precondition.go @@ -2,8 +2,8 @@ package task import ( "context" - "errors" + "github.com/go-task/task/v3/errors" "github.com/go-task/task/v3/internal/env" "github.com/go-task/task/v3/internal/execext" "github.com/go-task/task/v3/internal/logger"