From 615703512a77278e2ecd4c566aad91f4936ee6f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Wed, 20 Dec 2023 22:32:18 +0200 Subject: [PATCH 1/4] Update golangci-lint to 1.55.2, update depguard config --- .github/workflows/test.yml | 2 +- .golangci.yaml | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 97ea9004..fecccedc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.52.2 + version: v1.55.2 - name: go mod tidy run: go mod tidy - name: check for any changes diff --git a/.golangci.yaml b/.golangci.yaml index 40d1720e..f0a97075 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -9,9 +9,18 @@ linters-settings: disable: - fieldalignment depguard: - list-type: blacklist - include-go-root: true - include-go-std-lib: true + rules: + main: + allow: + - $gostd + - github.com/denisenkom/go-mssqldb + - github.com/go-sql-driver/mysql + - github.com/go-gorp/gorp/v3 + - github.com/lib/pq + - github.com/mattn/go-sqlite3 + - github.com/mitchellh/cli + - github.com/olekukonko/tablewriter + - github.com/rubenv/sql-migrate exhaustive: default-signifies-exhaustive: true nolintlint: From 4bbf8f96706d5d97bdabc9e113de7d0108ad7a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Wed, 20 Dec 2023 22:32:37 +0200 Subject: [PATCH 2/4] Avoid use of deprecated io/ioutil --- sql-migrate/config.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sql-migrate/config.go b/sql-migrate/config.go index c8564ab4..6947a534 100644 --- a/sql-migrate/config.go +++ b/sql-migrate/config.go @@ -5,7 +5,6 @@ import ( "errors" "flag" "fmt" - "io/ioutil" "os" "runtime/debug" @@ -45,7 +44,7 @@ type Environment struct { } func ReadConfig() (map[string]*Environment, error) { - file, err := ioutil.ReadFile(ConfigFile) + file, err := os.ReadFile(ConfigFile) if err != nil { return nil, err } From 2e2cc4c911e0af3483e826f83ee1e0223c96355a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Wed, 20 Dec 2023 22:38:04 +0200 Subject: [PATCH 3/4] Allow dot imports where idiomatic --- init_test.go | 1 + migrate_test.go | 1 + sort_test.go | 1 + sqlparse/sqlparse_test.go | 1 + toapply_test.go | 1 + 5 files changed, 5 insertions(+) diff --git a/init_test.go b/init_test.go index ce1a1716..c3bbe7fd 100644 --- a/init_test.go +++ b/init_test.go @@ -3,6 +3,7 @@ package migrate import ( "testing" + //revive:disable-next-line:dot-imports . "gopkg.in/check.v1" ) diff --git a/migrate_test.go b/migrate_test.go index 150ae4a2..d52debaa 100644 --- a/migrate_test.go +++ b/migrate_test.go @@ -9,6 +9,7 @@ import ( "github.com/go-gorp/gorp/v3" _ "github.com/mattn/go-sqlite3" + //revive:disable-next-line:dot-imports . "gopkg.in/check.v1" ) diff --git a/sort_test.go b/sort_test.go index 93743489..ca5d23c8 100644 --- a/sort_test.go +++ b/sort_test.go @@ -3,6 +3,7 @@ package migrate import ( "sort" + //revive:disable-next-line:dot-imports . "gopkg.in/check.v1" ) diff --git a/sqlparse/sqlparse_test.go b/sqlparse/sqlparse_test.go index 801f2d7c..693dd952 100644 --- a/sqlparse/sqlparse_test.go +++ b/sqlparse/sqlparse_test.go @@ -4,6 +4,7 @@ import ( "strings" "testing" + //revive:disable-next-line:dot-imports . "gopkg.in/check.v1" ) diff --git a/toapply_test.go b/toapply_test.go index 8ddd259b..5e6383e5 100644 --- a/toapply_test.go +++ b/toapply_test.go @@ -3,6 +3,7 @@ package migrate import ( "sort" + //revive:disable-next-line:dot-imports . "gopkg.in/check.v1" ) From f75fac3516d662fa66dcd0a33edb47fdc72a1fe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Wed, 20 Dec 2023 22:39:56 +0200 Subject: [PATCH 4/4] Appease goimports --- migrate_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/migrate_test.go b/migrate_test.go index d52debaa..f1d66d6f 100644 --- a/migrate_test.go +++ b/migrate_test.go @@ -8,9 +8,10 @@ import ( "time" "github.com/go-gorp/gorp/v3" - _ "github.com/mattn/go-sqlite3" //revive:disable-next-line:dot-imports . "gopkg.in/check.v1" + + _ "github.com/mattn/go-sqlite3" ) var sqliteMigrations = []*Migration{