diff --git a/.gometalinter.json b/.gometalinter.json new file mode 100644 index 00000000..ce732922 --- /dev/null +++ b/.gometalinter.json @@ -0,0 +1,26 @@ +{ + "Sort": ["linter", "severity", "path", "line"], + "WarnUnmatchedDirective": true, + "DisableAll": true, + "Enable": [ + "deadcode", + "errcheck", + "gocyclo", + "gofmt", + "goimports", + "golint", + "interfacer", + "lll", + "maligned", + "megacheck", + "misspell", + "nakedret", + "structcheck", + "unconvert", + "unparam", + "varcheck", + "vet" + ], + "Cyclo": 12, + "LineLength": 100 +} diff --git a/Dockerfile b/Dockerfile index fb2858c4..15aeac2e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,9 +15,8 @@ RUN apt-get update \ # development dependencies RUN curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.3.2/dep-linux-amd64 \ && chmod +x /usr/local/bin/dep -RUN go get \ - github.com/golang/lint/golint \ - github.com/kisielk/errcheck +RUN go get gopkg.in/alecthomas/gometalinter.v2 \ + && gometalinter.v2 --install # copy source files COPY . /go/src/github.com/amacneil/dbmate diff --git a/Makefile b/Makefile index 128ac0e1..be77f49b 100644 --- a/Makefile +++ b/Makefile @@ -19,9 +19,7 @@ test: .PHONY: lint lint: - golint -set_exit_status $(PACKAGES) - go vet $(PACKAGES) - errcheck $(PACKAGES) + gometalinter.v2 $(PACKAGES) .PHONY: clean clean: diff --git a/main_test.go b/main_test.go index 73d52271..f772945b 100644 --- a/main_test.go +++ b/main_test.go @@ -11,9 +11,7 @@ import ( ) func testContext(t *testing.T, u *url.URL) *cli.Context { - var err error - - err = os.Setenv("DATABASE_URL", u.String()) + err := os.Setenv("DATABASE_URL", u.String()) require.Nil(t, err) app := NewApp() diff --git a/pkg/dbmate/db.go b/pkg/dbmate/db.go index df75db11..1e1a196a 100644 --- a/pkg/dbmate/db.go +++ b/pkg/dbmate/db.go @@ -182,11 +182,7 @@ func (db *DB) NewMigration(name string) error { defer mustClose(file) _, err = file.WriteString(migrationTemplate) - if err != nil { - return err - } - - return nil + return err } func doTransaction(db *sql.DB, txFunc func(Transaction) error) error { diff --git a/pkg/dbmate/mysql.go b/pkg/dbmate/mysql.go index 62b96333..0edaad9e 100644 --- a/pkg/dbmate/mysql.go +++ b/pkg/dbmate/mysql.go @@ -105,7 +105,7 @@ func mysqldumpArgs(u *url.URL) []string { if username := u.User.Username(); username != "" { args = append(args, "--user="+username) } - // mysql recommands against using environment variables to supply password + // mysql recommends against using environment variables to supply password // https://dev.mysql.com/doc/refman/5.7/en/password-security-user.html if password, set := u.User.Password(); set { args = append(args, "--password="+password)