Skip to content

Commit 36fecb6

Browse files
thspintoAzuka
authored andcommitted
Updated linter to golangci-lint (#13)
* Updated linter to golangci-lint * Removed support for go1.9 and added for go1.12
1 parent 9bd3f0d commit 36fecb6

File tree

6 files changed

+33
-35
lines changed

6 files changed

+33
-35
lines changed

.circleci/config.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ references:
2323

2424
version: 2
2525
jobs:
26-
go-1.9:
27-
<<: *defaults
28-
docker:
29-
- image: circleci/golang:1.9
3026
go-1.10:
3127
<<: *defaults
3228
docker:
@@ -35,11 +31,15 @@ jobs:
3531
<<: *defaults
3632
docker:
3733
- image: circleci/golang:1.11
34+
go-1.12:
35+
<<: *defaults
36+
docker:
37+
- image: circleci/golang:1.12
3838

3939
workflows:
4040
version: 2
4141
test-all-go-versions:
4242
jobs:
43-
- go-1.9
4443
- go-1.10
45-
- go-1.11
44+
- go-1.11
45+
- go-1.12

.golangci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
run:
2+
skip-dirs:
3+
- vendor$
4+
5+
linters:
6+
enable:
7+
- deadcode
8+
- unconvert
9+
- errcheck
10+
- vet
11+
- vetshadow
12+
- golint
13+
- gosimple
14+
- misspell
15+
16+
issues:
17+
exclude-rules:
18+
- path: keycloak/service\.go
19+
linters:
20+
- structcheck

.gometalinter.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ CI_TEST_REPORTS ?= /tmp/test-results
1919
init-ci:
2020
@echo "$(OK_COLOR)==> Installing minimal build requirements$(NO_COLOR)"
2121
dep ensure -v
22-
curl -L https://git.io/vp6lP | sh
22+
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh
2323
go get -u github.com/jstemmer/go-junit-report
2424

2525
.PHONY: init
@@ -44,8 +44,7 @@ generate:
4444
.PHONY: lint
4545
lint:
4646
@echo "$(OK_COLOR)==> Linting$(NO_COLOR)$(NO_COLOR)"
47-
@go list -f '{{.Dir}}' ./... | grep -v 'vendor' | \
48-
xargs gometalinter
47+
./bin/golangci-lint run
4948

5049
# Test
5150
.PHONY: test
@@ -104,7 +103,7 @@ test-circle:
104103
.PHONY: lint-ci
105104
lint-ci:
106105
@echo "$(OK_COLOR)==> Running CI lint$(NO_COLOR)"
107-
go list -f '{{.Dir}}' ./... | grep -v 'vendor' | xargs gometalinter --json > lint.json
106+
/bin/golangci-lint run --out-format json > lint.json
108107

109108
# Quick test for rapid dev-feedback cycles
110109
.PHONY: qt

keycloak/auth/auth_example_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func ExampleConfig_Client() {
1818
client := config.Client(context.Background())
1919

2020
// This will make an authenticated request
21-
client.Get("https://keycloak.local/auth/admin/realms/master/users?username=keycloak-admin")
21+
_, _ = client.Get("https://keycloak.local/auth/admin/realms/master/users?username=keycloak-admin")
2222
}
2323

2424
func ExampleConfig_Client_client_credentials() {
@@ -32,5 +32,5 @@ func ExampleConfig_Client_client_credentials() {
3232
client := config.Client(context.Background())
3333

3434
// This will make an authenticated request
35-
client.Get("https://keycloak.local/auth/admin/realms/master/users?username=keycloak-admin")
35+
_, _ = client.Get("https://keycloak.local/auth/admin/realms/master/users?username=keycloak-admin")
3636
}

keycloak/user_service_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
func ExampleNewUserService() {
1515
userService := NewUserService(&Client{})
16-
userService.Create(context.TODO(), "my-realm", &UserRepresentation{})
16+
_, _ = userService.Create(context.TODO(), "my-realm", &UserRepresentation{})
1717
}
1818

1919
type userServiceTests struct {
@@ -80,7 +80,7 @@ func (suite *userServiceTests) TestUserServiceCreateUserFailure() {
8080

8181
suite.True(ok)
8282
suite.NotNil(actualError)
83-
//suite.Equal(500, actualError.Code)
83+
suite.Equal(500, actualError.Code)
8484
}
8585

8686
func (suite *userServiceTests) TestUserServiceUpdateUser() {

0 commit comments

Comments
 (0)