Skip to content

Commit

Permalink
Add lint workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoConstantine committed Jun 28, 2024
1 parent cbb35fb commit d1a83a9
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Lint
on:
push:
paths:
- "**.go"
- go.mod
- go.sum
pull_request:
paths:
- "**.go"
- go.mod
- go.sum

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.19
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Check out code
uses: actions/checkout@v2

- name: Verify dependencies
env:
LINT_VERSION: 1.50.1
run: |
go mod verify
go mod download
curl -fsSL https://github.com/golangci/golangci-lint/releases/download/v${LINT_VERSION}/golangci-lint-${LINT_VERSION}-linux-amd64.tar.gz | \
tar xz --strip-components 1 --wildcards \*/golangci-lint
mkdir -p bin && mv golangci-lint bin/
- name: Run checks
run: bin/golangci-lint run --out-format=github-actions
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ func mainRun() exitCode {
rootCmd, err := cmd.NewRootCmd(iostream)

if err != nil {
fmt.Fprint(stderr, "failed to create root command: %s\n", err)
fmt.Fprintf(stderr, "failed to create root command: %s\n", err)
return exitError
}
if _, err := rootCmd.ExecuteContextC(ctx); err != nil {
if command, err := rootCmd.ExecuteContextC(ctx); err != nil {
// printError(stderr, err, cmd, hasDebug)
// fmt.Fprint(stderr, "Error %s", err, command)
fmt.Fprintf(stderr, "Error %v", command)

}
return exitOK
Expand Down

0 comments on commit d1a83a9

Please sign in to comment.