Skip to content

Commit

Permalink
Update Dockerfiles and taskfile.yaml for golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardolat committed Jul 30, 2024
1 parent 51e06d1 commit f764bf0
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
run:
timeout: "5m"

linters:
disable-all: true
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- unused
6 changes: 6 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ RUN wget https://github.com/sqlc-dev/sqlc/releases/download/v1.26.0/sqlc_1.26.0_
mv ./sqlc /usr/local/bin/sqlc && \
chmod 777 /usr/local/bin/sqlc

# Install golangci-lint
RUN wget https://github.com/golangci/golangci-lint/releases/download/v1.59.1/golangci-lint-1.59.1-linux-amd64.tar.gz && \
tar -xzf golangci-lint-1.59.1-linux-amd64.tar.gz && \
mv ./golangci-lint-1.59.1-linux-amd64/golangci-lint /usr/local/bin/golangci-lint && \
chmod 777 /usr/local/bin/golangci-lint

# Delete the temporary directory and go to the app directory
WORKDIR /app
RUN rm -rf /app/temp
Expand Down
6 changes: 6 additions & 0 deletions docker/Dockerfile.cicd
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ RUN wget https://github.com/sqlc-dev/sqlc/releases/download/v1.26.0/sqlc_1.26.0_
mv ./sqlc /usr/local/bin/sqlc && \
chmod 777 /usr/local/bin/sqlc

# Install golangci-lint
RUN wget https://github.com/golangci/golangci-lint/releases/download/v1.59.1/golangci-lint-1.59.1-linux-amd64.tar.gz && \
tar -xzf golangci-lint-1.59.1-linux-amd64.tar.gz && \
mv ./golangci-lint-1.59.1-linux-amd64/golangci-lint /usr/local/bin/golangci-lint && \
chmod 777 /usr/local/bin/golangci-lint

# Delete the temporary directory and go to the app directory
WORKDIR /app
RUN rm -rf /app/temp
Expand Down
6 changes: 6 additions & 0 deletions docker/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ RUN wget https://github.com/sqlc-dev/sqlc/releases/download/v1.26.0/sqlc_1.26.0_
mv ./sqlc /usr/local/bin/sqlc && \
chmod 777 /usr/local/bin/sqlc

# Install golangci-lint
RUN wget https://github.com/golangci/golangci-lint/releases/download/v1.59.1/golangci-lint-1.59.1-linux-amd64.tar.gz && \
tar -xzf golangci-lint-1.59.1-linux-amd64.tar.gz && \
mv ./golangci-lint-1.59.1-linux-amd64/golangci-lint /usr/local/bin/golangci-lint && \
chmod 777 /usr/local/bin/golangci-lint

# Delete the temporary directory and go to the app directory
WORKDIR /app
RUN rm -rf /app/temp
Expand Down
14 changes: 12 additions & 2 deletions taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,21 @@ tasks:
- go fmt ./...
- npm run standard

test:
lint-only:
cmds:
- task fmt
- task gen-db
- golangci-lint run ./...

test-only:
cmds:
- task gen-db
- go test ./...

test:
cmds:
- task lint-only
- task test-only

clean:
cmds:
- rm -rf ./tmp
Expand Down

0 comments on commit f764bf0

Please sign in to comment.