added linting

This commit is contained in:
Kai Reichart 2024-11-28 14:09:51 +01:00
parent 7a8de6f404
commit 2a2a125681
2 changed files with 43 additions and 0 deletions

22
.github/workflows/golang-ci-lint.yml vendored Normal file
View file

@ -0,0 +1,22 @@
name: Run Go Lint
on:
workflow_call:
inputs:
source:
description: 'The source for running the tests'
required: false
type: string
default: './...'
jobs:
build-go:
runs-on: docker
container:
image: forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/pipeline-container/golang-ci-lint:v1.62
steps:
- name: Clone Repository
uses: https://forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/DevFW-CICD/checkout@main
- name: Run go build
run: |
golangci-lint run ${{ inputs.source }} --out-format=json --timeout 5m --issues-exit-code 1

View file

@ -0,0 +1,21 @@
# Run Go Lint GitHub Action
This GitHub Action uses `golangci-lint` to lint Go source code, ensuring code quality and adherence to best practices.
## Inputs
| Input Name | Description | Required | Type | Default Value |
|------------|-----------------------------------|----------|--------|---------------|
| `source` | The source files or directories to lint. | No | string | `./...` |
## Usage
The action can be reused with `workflow_call`. Here's an example of how to invoke it:
```yaml
jobs:
lint:
uses: DevFW-CICD/lint/.github/workflows/golang-ci-lint.yml@main
with:
source: './pkg/...'
```