diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 34790dc..0c1553f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -40,9 +40,7 @@ jobs: with: go-version: '1.20' cache: false - # Runs the default linters provided by golangci-lint plus golint and godot. - name: Run linters uses: golangci/golangci-lint-action@v3 with: - version: v1.52 - args: --enable=golint --enable=godot --timeout=3m + version: v1.53 diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..79c503a --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,16 @@ +# Options for analysis running. +run: + timeout: 5m + skip-dirs: + - .git +linters: + enable: + - revive + - godot + - gofmt +linters-settings: + revive: + rules: + - name: blank-imports + severity: warning + disabled: true diff --git a/Makefile b/Makefile index 57b1537..8e4c667 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ int-test: .PHONY: linter ## linter: Runs the golangci-lint command linter: - golangci-lint run --enable=golint --enable=godot --enable=gofmt ./... + golangci-lint run ./... .PHONY: test-all ## test-all: Runs the integration testing bash script with different database docker image versions diff --git a/cmd/dbmigrate/cmd/migrate.go b/cmd/dbmigrate/cmd/migrate.go index c193f8c..85cc181 100644 --- a/cmd/dbmigrate/cmd/migrate.go +++ b/cmd/dbmigrate/cmd/migrate.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -16,8 +16,9 @@ limitations under the License. package cmd import ( - "github.com/danvergara/dblab/pkg/config" "github.com/spf13/cobra" + + "github.com/danvergara/dblab/pkg/config" ) var cfg *config.Config diff --git a/cmd/dbmigrate/cmd/migratedown.go b/cmd/dbmigrate/cmd/migratedown.go index 636bf8d..ad0f9d9 100644 --- a/cmd/dbmigrate/cmd/migratedown.go +++ b/cmd/dbmigrate/cmd/migratedown.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -19,12 +19,10 @@ import ( "log" "github.com/golang-migrate/migrate/v4" - "github.com/spf13/cobra" - - // drivers. _ "github.com/golang-migrate/migrate/v4/database/mysql" _ "github.com/golang-migrate/migrate/v4/database/postgres" _ "github.com/golang-migrate/migrate/v4/source/file" + "github.com/spf13/cobra" ) // migratedownCmd represents the migratedown command. @@ -37,7 +35,7 @@ and usage of using your command. For example: Cobra is a CLI library for Go that empowers applications. This application is a tool to generate the needed files to quickly create a Cobra application.`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { m, err := migrate.New("file://db/migrations", cfg.GetDBConnStr()) if err != nil { diff --git a/cmd/dbmigrate/cmd/migrateup.go b/cmd/dbmigrate/cmd/migrateup.go index 0cd1efd..8273135 100644 --- a/cmd/dbmigrate/cmd/migrateup.go +++ b/cmd/dbmigrate/cmd/migrateup.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -19,12 +19,10 @@ import ( "fmt" "log" - "github.com/spf13/cobra" - - // drivers. _ "github.com/golang-migrate/migrate/v4/database/mysql" _ "github.com/golang-migrate/migrate/v4/database/postgres" _ "github.com/golang-migrate/migrate/v4/source/file" + "github.com/spf13/cobra" ) // migrateupCmd represents the migrateup command. @@ -37,7 +35,7 @@ and usage of using your command. For example: Cobra is a CLI library for Go that empowers applications. This application is a tool to generate the needed files to quickly create a Cobra application.`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { fmt.Printf("cfg: %v\n", cfg) m, err := cfg.MigrateInstance() if err != nil { diff --git a/cmd/dbmigrate/cmd/root.go b/cmd/dbmigrate/cmd/root.go index 14f3995..5750387 100644 --- a/cmd/dbmigrate/cmd/root.go +++ b/cmd/dbmigrate/cmd/root.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/cmd/dbmigrate/main.go b/cmd/dbmigrate/main.go index 8dd2b39..94831ec 100644 --- a/cmd/dbmigrate/main.go +++ b/cmd/dbmigrate/main.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/main.go b/main.go index 3275c77..ac4ea4b 100644 --- a/main.go +++ b/main.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,