Skip to content

Commit

Permalink
📋 extended linting for PRs (#918)
Browse files Browse the repository at this point in the history
* extended linting for PRs

Signed-off-by: Ivan Milchev <ivan@mondoo.com>

* try to run action

Signed-off-by: Ivan Milchev <ivan@mondoo.com>

* Fix config path

Signed-off-by: Ivan Milchev <ivan@mondoo.com>

* add a new linter warning

Signed-off-by: Ivan Milchev <ivan@mondoo.com>

* try govet

Signed-off-by: Ivan Milchev <ivan@mondoo.com>

* cleanup

Signed-off-by: Ivan Milchev <ivan@mondoo.com>

---------

Signed-off-by: Ivan Milchev <ivan@mondoo.com>
  • Loading branch information
imilchev authored Oct 31, 2023
1 parent 4180292 commit 53f4478
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (c) Mondoo, Inc.
# SPDX-License-Identifier: BUSL-1.1

# See https://golangci-lint.run/usage/configuration/ for configuration options
run:
timeout: 5m
skip-dirs:
skip-files:
- ".*\\.pb\\.go$"
- ".*\\.lr\\.go$"
modules-download-mode: readonly

linters:
disable-all: true
enable:
- errcheck
- gosimple
- ineffassign
- unused
- gofmt
- staticcheck
- govet

linters-settings:
gofmt:
simplify: false

govet:
# enable or disable analyzers by name
# run `go tool vet help` to see all analyzers
enable:
- structtag
- lostcancel
disable-all: true
29 changes: 29 additions & 0 deletions .github/workflows/pr-extended-linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Extended Linting

## Only trigger tests if source is changing
on:
pull_request:
paths:
- '**.go'
- '**.mod'
- 'go.sum'

jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ">=${{ env.golang-version }}"
cache: false
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3.7.0
with:
version: latest
args: --config=.github/.golangci.yml --timeout=30m
only-new-issues: true

0 comments on commit 53f4478

Please sign in to comment.