Skip to content

Commit

Permalink
Create golint.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
lvmingze123 authored Oct 28, 2024
1 parent fb236ec commit 417c2c7
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/golint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Go Lint


on:

push:
branches: [ main ]

pull_request:
branches: [ '**' ]

# 定义工作流程
jobs:
golangci:
name: lint
runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v3


- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true


- name: Install dependencies
run: go mod download


- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout=5m


- name: Check code formatting
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
echo "Code is not properly formatted. Please run 'go fmt'"
gofmt -s -l .
exit 1
fi
- name: Run go vet
run: go vet ./...

0 comments on commit 417c2c7

Please sign in to comment.