Skip to content

fix: resolve linting issues and modernize code #3

fix: resolve linting issues and modernize code

fix: resolve linting issues and modernize code #3

Workflow file for this run

name: Lint and Scan
on:
# Only run on PRs targeting master
pull_request:
branches: [ master ]
types: [opened, synchronize, reopened]
# For direct pushes to master only
push:
branches: [ master ]
paths-ignore:
- '**.md'
- 'docs/**'
- '.github/**'
- '!.github/workflows/lint.yml'
# Prevent duplicate workflow runs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
golangci:
name: Go Linting
runs-on: ubuntu-latest
# Allow job to succeed even with lint issues for now
continue-on-error: true
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24.x
cache: true
# Simple linting first using standard go tools
- name: Run go fmt
run: |
go fmt ./...
- name: Run go vet
run: |
go vet ./...
- name: Run golangci-lint
id: lint
uses: golangci/golangci-lint-action@v7
with:
version: latest
gosec-issues:
name: Security Scan Issues
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: List security issues
uses: securego/gosec@master
with:
args: -exclude-generated ./...
license-check:
name: License Compliance
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24.x
- name: Check License Headers
run: |
# Only check Go files that aren't in vendor or generated
echo "Checking for Apache License headers in Go files..."
# Store files missing license in a variable
MISSING_LICENSE=$(find . -name "*.go" -type f -not -path "*/vendor/*" -not -path "*/mocks/*" | xargs grep -L "Licensed under the Apache License" || true)
# If any files are missing license headers, report and exit with error
if [ -n "$MISSING_LICENSE" ]; then
echo "ERROR: The following files are missing Apache License headers:"
echo "$MISSING_LICENSE"
echo "License check failed. Please add the appropriate license headers."
exit 1
else
echo "License check passed. All files have proper license headers."
fi