Skip to content

Commit

Permalink
Add gometalinter (amacneil#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
amacneil authored Apr 16, 2018
1 parent cacf5de commit ee3162c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 15 deletions.
26 changes: 26 additions & 0 deletions .gometalinter.json
Original file line number Diff line number Diff line change
@@ -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
}
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ test:

.PHONY: lint
lint:
golint -set_exit_status $(PACKAGES)
go vet $(PACKAGES)
errcheck $(PACKAGES)
gometalinter.v2 $(PACKAGES)

.PHONY: clean
clean:
Expand Down
4 changes: 1 addition & 3 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 1 addition & 5 deletions pkg/dbmate/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/dbmate/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ee3162c

Please sign in to comment.