Skip to content

Commit

Permalink
Add a golint action
Browse files Browse the repository at this point in the history
Signed-off-by: apostasie <[email protected]>
  • Loading branch information
apostasie committed Dec 13, 2024
1 parent cb49ffc commit f88e3a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
10 changes: 8 additions & 2 deletions .github/actions/lint-go/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ inputs:
cache-dependency-path:
description: 'Used to specify the path to a dependency file - go.sum'
strategy:
description: "See intall-go for info"
description: "See install-go for info"
_golangci_version:
default: "89476e7a1eaa0a8a06c17343af960a5fd9e7edb7" # v1.62.2
_goimports_version:
default: "f034195cc8a7ffc7cc70d60aa3a25500874eaf04" # v3.8.2

runs:
using: composite
Expand All @@ -17,10 +21,12 @@ runs:
uses: golangci/golangci-lint-action@774c35bcccffb734694af9e921f12f57d882ef74 # v6.1.1
with:
args: --verbose
install-mode: goinstall
version: ${{ inputs._golangci_version }}
skip-save-cache: true
skip-cache: true
- name: "Check that go imports ordering is ok"
shell: bash
run: |
go install -v github.com/incu6us/goimports-reviser/v3@f034195cc8a7ffc7cc70d60aa3a25500874eaf04 # v3.8.2
go install -v github.com/incu6us/goimports-reviser/v3@${{ inputs._goimports_version }}
make lint-imports
22 changes: 4 additions & 18 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ jobs:
timeout-minutes: 5
name: "go | ${{ matrix.goos }} | ${{ matrix.goversion }}"
runs-on: "${{ matrix.os }}"
defaults:
run:
shell: bash
strategy:
matrix:
include:
Expand All @@ -38,31 +35,20 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- name: "Install go"
uses: ./.github/actions/install-go
- name: "Run go linters"
uses: ./.github/actions/lint-go
with:
strategy: ${{ matrix.goversion }}
- name: golangci-lint
uses: golangci/golangci-lint-action@774c35bcccffb734694af9e921f12f57d882ef74 # v6.1.1
with:
args: --verbose

other:
timeout-minutes: 5
name: yaml | shell | imports order
name: yaml | shell
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- name: "Install go"
uses: ./.github/actions/install-go
with:
strategy: latest-stable
- name: yaml
run: make lint-yaml
- name: shell
run: make lint-shell
- name: go imports ordering
run: |
go install -v github.com/incu6us/goimports-reviser/v3@latest
make lint-imports

0 comments on commit f88e3a2

Please sign in to comment.