Skip to content

Added go lint check/fixed issues/updated gh workflow #34

Added go lint check/fixed issues/updated gh workflow

Added go lint check/fixed issues/updated gh workflow #34

Workflow file for this run

name: Run Unit Tests
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23.4'
- name: Cache Go modules
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run tests with coverage
run: |
go mod tidy
go test -coverprofile=coverage.out ./...
- name: Show coverage
run: |
go tool cover -func=coverage.out
- name: Build Docker image
run: |
docker build -t go-scraper-api .
- name: Run golangci-lint
run: |
./golangci-lint run
- name: Report golangci-lint output
run: |
if [ $? -ne 0 ]; then
echo "golangci-lint found issues:"
./golangci-lint run
else
echo "golangci-lint found no issues. All good!"
fi