Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
Replacing gometalinter with golangci-lint (#1677)
Browse files Browse the repository at this point in the history
* replacing gometalinter with golangci-lint

* fixing linter names and some failing errchecks

* removing unneeded flag

* disabling errcheck as it was disabled in gometalinter

* reverting changes to app.go

* adding golangcilint via curl
  • Loading branch information
paganotoni authored and stanislas-m committed Jun 2, 2019
1 parent 978b209 commit f532c43
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 19 deletions.
18 changes: 18 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
fast: true
linters:
enable-all: false
disable-all: false
enable:
- govet
- golint
- goimports
- deadcode
- typecheck
- ineffassign
- misspell
- nakedret
- unconvert
- megacheck
- varcheck
disable:
- errcheck
3 changes: 0 additions & 3 deletions .gometalinter.json

This file was deleted.

6 changes: 3 additions & 3 deletions Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ RUN go get -u github.com/golang/dep/cmd/dep \
&& go get -v -u github.com/gobuffalo/packr/v2/packr2 \
&& go get -v -u github.com/markbates/filetest \
&& go get -v -u github.com/markbates/grift \
&& go get -v -u github.com/markbates/refresh \
&& go get -u github.com/alecthomas/gometalinter \
&& gometalinter --install
&& go get -v -u github.com/markbates/refresh

RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.16.0

# clear out the src so that we can fill it with new versions
RUN rm -rfv $GOPATH/src && mkdir -p $BP
Expand Down
7 changes: 4 additions & 3 deletions Dockerfile.slim.build
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ RUN go get -u github.com/golang/dep/cmd/dep \
&& go get -v -u github.com/markbates/refresh \
&& go get -v -u github.com/gobuffalo/httptest \
&& go get -v -u github.com/gorilla/sessions \
&& go get -v -u golang.org/x/vgo \
&& go get -u github.com/alecthomas/gometalinter \
&& gometalinter --install
&& go get -v -u golang.org/x/vgo

RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.16.0


RUN npm i -g --no-progress yarn \
&& yarn config set yarn-offline-mirror /npm-packages-offline-cache \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ci-test:
docker build . --no-cache --build-arg TRAVIS_BRANCH=$$(git symbolic-ref --short HEAD)

lint:
gometalinter --vendor ./... --deadline=1m --skip=internal
golangci-lint --vendor ./... --deadline=1m --skip=internal

update:
$(GO_BIN) get -u -tags ${TAGS}
Expand Down
4 changes: 3 additions & 1 deletion app.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func (a *App) Muxer() *mux.Router {
func New(opts Options) *App {
LoadPlugins()
envy.Load()

opts = optionsWithDefaults(opts)

a := &App{
Expand All @@ -56,7 +57,8 @@ func New(opts Options) *App {
return func(res http.ResponseWriter, req *http.Request) {
c := a.newContext(RouteInfo{}, res, req)
err := fmt.Errorf(errorf, req.Method, req.URL.Path)
a.ErrorHandlers.Get(code)(code, err, c)
_ = a.ErrorHandlers.Get(code)(code, err, c)

}
}

Expand Down
2 changes: 1 addition & 1 deletion buffalo/cmd/destroy/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package destroy

import (
"errors"
"github.com/gobuffalo/flect"

"github.com/gobuffalo/flect"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion buffalo/cmd/destroy/mailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package destroy
import (
"errors"
"fmt"
"github.com/gobuffalo/flect"
"os"
"path/filepath"

"github.com/gobuffalo/flect"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand Down
10 changes: 4 additions & 6 deletions grifts/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ var _ = grift.Namespace("tools", func() {
}

var _ = grift.Add("install", func(c *grift.Context) error {
if _, err := exec.LookPath("gometalinter"); err != nil {
if err := run("go", "get", "-u", "-v", "github.com/alecthomas/gometalinter"); err != nil {
return err
}
if err := run("gometalinter", "--install"); err != nil {
if _, err := exec.LookPath("golangci-lint"); err != nil {
if err := run("go", "get", "-v", "github.com/golangci/golangci-lint/cmd/golangci-lint"); err != nil {
return err
}
}
Expand All @@ -33,7 +30,8 @@ var _ = grift.Namespace("tools", func() {
if err := grift.Run("tools:install", c); err != nil {
return err
}
return run("gometalinter", "--vendor", "--deadline=3m", "./...")

return run("golangci-lint", "run", "--fast", "--deadline=3m")
})

})

0 comments on commit f532c43

Please sign in to comment.