Skip to content

Commit

Permalink
add linter
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaqiuxy committed Jun 7, 2021
1 parent 3ac1fc0 commit b5e0ead
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
# Run tests
- run: go test
- run: make test
29 changes: 29 additions & 0 deletions .golangci.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[run]
timeout = "120s"

[output]
format = "colored-line-number"

[linters]
enable = [
"deadcode",
"errcheck",
"goconst",
"gocyclo",
"gofumpt"
"goimports",
"golint",
"ineffassign",
"interfacer",
"misspell",
"nakedret",
"unconvert",
"unparam",
"unused",
"varcheck",
"vet",
"vetshadow",
]

[issues]
exclude-use-default = false
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ FROM golang:${GOLANG_VERSION}

WORKDIR /wfcache

RUN go get -u github.com/mitranim/gow@latest
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.40.1

COPY . .
18 changes: 16 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
test:
docker-compose up
dev:
docker compose build
docker compose up --abort-on-container-exit

test: fmt
go test

fmt:
go fmt ./...

LINTER := $(shell command -v $(shell go env GOPATH)/bin/golangci-lint 2> /dev/null)
lint:
ifndef LINTER
go get github.com/golangci/golangci-lint/cmd/[email protected]
endif
$(shell go env GOPATH)/bin/golangci-lint run ./...
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
build:
context: .
container_name: wfcache_test
command: go test
command: make test
depends_on:
- redis
- dynamodb-local

0 comments on commit b5e0ead

Please sign in to comment.