Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(linters): added golangci-lint #134

Merged
merged 2 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ jobs:
run: go mod download
- name: Build csm-topology Docker Image
run: make clean build docker
- name: Image scanner
uses: Azure/container-scan@v0
- name: Run Trivy action
uses: aquasecurity/trivy-action@master
with:
image-name: csm-topology
severity-threshold: HIGH
env:
DOCKLE_HOST: "unix:///var/run/docker.sock"
image-ref: csm-topology
30 changes: 30 additions & 0 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: linters

on:
push:
branches: [main]
pull_request:
branches: ["**"]

permissions:
contents: read

jobs:
golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.20"
cache: false
- name: Checkout the code
uses: actions/checkout@v3.2.0
- name: Vendor packages
run: |
go mod vendor
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.53
skip-cache: true
30 changes: 30 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
run:
timeout: 20m
issue-exit-code: 0 # we will change this later
tests: true
skip-dirs-use-default: true
modules-download-mode: readonly

issues:
max-issues-per-linter: 0
max-same-issues: 0
new: false

output:
print-linter-name: true
sort-results: true
uniq-by-line: false
print-issued-lines: true

linters:
disable-all: true
fast: false
enable:
# A stricter replacement for gofmt.
- gofumpt
# Inspects source code for security problems.
- gosec
# Check for correctness of programs.
- govet
# Drop-in replacement of golint.
- revive
Loading