-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #231 from dnephin/ci-update-linters
Ci update linters
- Loading branch information
Showing
12 changed files
with
40 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
go: gotest/[email protected].13 | ||
go: gotest/[email protected].14 | ||
|
||
workflows: | ||
ci: | ||
|
@@ -49,13 +49,15 @@ executors: | |
jobs: | ||
|
||
lint: | ||
executor: go/golang | ||
executor: | ||
name: go/golang | ||
tag: 1.18-alpine | ||
steps: | ||
- checkout | ||
- go/install-golangci-lint: | ||
prefix: v2 | ||
version: 1.21.0 | ||
prefix: v1.45.2 | ||
version: 1.45.2 | ||
- go/install: {package: git} | ||
- run: | ||
name: Lint | ||
command: | | ||
golangci-lint run -v --concurrency 2 | ||
command: golangci-lint run -v --concurrency 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,24 @@ | ||
package icmd | ||
|
||
import ( | ||
"fmt" | ||
"syscall" | ||
"errors" | ||
|
||
exec "golang.org/x/sys/execabs" | ||
) | ||
|
||
// getExitCode returns the ExitStatus of a process from the error returned by | ||
// exec.Run(). If the exit status could not be parsed an error is returned. | ||
func getExitCode(err error) (int, error) { | ||
if exiterr, ok := err.(*exec.ExitError); ok { | ||
if procExit, ok := exiterr.Sys().(syscall.WaitStatus); ok { | ||
return procExit.ExitStatus(), nil | ||
} | ||
} | ||
return 0, fmt.Errorf("failed to get exit code: %w", err) | ||
} | ||
|
||
func processExitCode(err error) (exitCode int) { | ||
func processExitCode(err error) int { | ||
if err == nil { | ||
return 0 | ||
} | ||
exitCode, exiterr := getExitCode(err) | ||
if exiterr != nil { | ||
// TODO: Fix this so we check the error's text. | ||
// we've failed to retrieve exit code, so we set it to 127 | ||
return 127 | ||
|
||
var exitErr *exec.ExitError | ||
if errors.As(err, &exitErr) { | ||
if exitErr.ProcessState == nil { | ||
return 0 | ||
} | ||
if code := exitErr.ProcessState.ExitCode(); code != -1 { | ||
return code | ||
} | ||
} | ||
return exitCode | ||
return 127 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters