Skip to content

Commit

Permalink
ci: add staticcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanhitt committed Jan 31, 2024
1 parent bc77ccb commit 5b2a0d1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
name: commit_lint
on: [pull_request]
name: lint

permissions:
contents: read
pull-requests: read
on:
pull_request:
push:
branches:
- "main"

jobs:
commitlint:
staticcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: wagoid/commitlint-github-action@v5
- uses: actions/setup-go@v3
- run: go install honnef.co/go/tools/cmd/staticcheck@latest
- run: ~/go/bin/staticcheck -checks all
File renamed without changes.
14 changes: 14 additions & 0 deletions .github/workflows/validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: validation

on: [pull_request]

permissions:
contents: read
pull-requests: read

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: wagoid/commitlint-github-action@v5
7 changes: 5 additions & 2 deletions command.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Package cmd is a simple package
// to execute shell commeand on linux,
// windows, and osx.
package cmd

import (
Expand Down Expand Up @@ -245,12 +248,12 @@ func (c *Command) ExecuteContext(ctx context.Context) error {
select {
case <-ctx.Done():
if err := cmd.Process.Kill(); err != nil {
return fmt.Errorf("Timeout occurred and can not kill process with pid %v", cmd.Process.Pid)
return fmt.Errorf("timeout occurred and can not kill process with pid %v", cmd.Process.Pid)
}

err := ctx.Err()
if c.Timeout > 0 && !hasDeadline {
err = fmt.Errorf("Command timed out after %v", c.Timeout)
err = fmt.Errorf("command timed out after %v", c.Timeout)
}
return err
case err := <-done:
Expand Down

0 comments on commit 5b2a0d1

Please sign in to comment.