diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0799f4..430a9a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,4 +39,4 @@ jobs: restore-keys: | ${{ runner.os }}-go- # Run tests - - run: go test + - run: make test diff --git a/.golangci.toml b/.golangci.toml new file mode 100644 index 0000000..55f3f21 --- /dev/null +++ b/.golangci.toml @@ -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 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index b5e3ef1..73317b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 . . \ No newline at end of file diff --git a/Makefile b/Makefile index 3aea6c2..e52a5bb 100644 --- a/Makefile +++ b/Makefile @@ -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/golangci-lint@v1.40.1 +endif + $(shell go env GOPATH)/bin/golangci-lint run ./... diff --git a/docker-compose.yaml b/docker-compose.yaml index 29dfc98..466c9d9 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -17,7 +17,7 @@ services: build: context: . container_name: wfcache_test - command: go test + command: make test depends_on: - redis - dynamodb-local