Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module example.com/m

go 1.22.3

45 changes: 45 additions & 0 deletions workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: GoLint

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.22'

- name: Run linter
run: |
go get -u golang.org/x/lint/golint
golint ./...

- name: Review code
if: always()
uses: actions/github-script@0.9.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const outputs = [];
const lintOutput = require('child_process')
.execSync('golint ./...', { encoding: 'utf8' });
outputs.push(lintOutput);
if (outputs.length) {
console.log('Found linting issues:');
outputs.forEach(output => console.log(output));
throw new Error('Linting issues were found. Please fix them before merging.');
} else {
console.log('No linting issues found.');
}