Fix Lint errors and resort GitHub action steps.

This commit is contained in:
Andrew Walsh 2023-11-26 23:28:42 -08:00
parent 1d63750e87
commit 90d6c1c39e
2 changed files with 9 additions and 8 deletions

View file

@ -7,7 +7,7 @@ permissions:
contents: read contents: read
jobs: jobs:
lint_build_test: integrate:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
@ -18,12 +18,12 @@ jobs:
with: with:
go-version-file: "go.mod" go-version-file: "go.mod"
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2
- name: Build and test - name: Build and test
run: | run: |
go build -v ./... go build -v ./...
go test -v ./... go test -v ./...
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2

View file

@ -44,7 +44,7 @@ func execCommand(name string, arg ...string) string {
cmd := exec.Command(name, arg...) cmd := exec.Command(name, arg...)
out, err := cmd.CombinedOutput() out, err := cmd.CombinedOutput()
if err != nil { if err != nil {
fmt.Fprintln(os.Stderr, fmt.Sprintf("Error code %d encountered while running %s\n%s", cmd.ProcessState.ExitCode(), strings.Join(cmd.Args, " "), string(out))) fmt.Fprintf(os.Stderr, "Error code %d encountered while running %s\n%s\n", cmd.ProcessState.ExitCode(), strings.Join(cmd.Args, " "), string(out))
os.Exit(2) os.Exit(2)
} }
return string(out) return string(out)
@ -97,10 +97,11 @@ func main() {
pkgNames := os.Args[2:] pkgNames := os.Args[2:]
switch command { switch command {
case "normalized-list": case "normalized-list":
pkgs := getPackages(pkgNames) pkgs := getPackages(pkgNames)
fmt.Println(pkgs.serialize()) fmt.Println(pkgs.serialize())
break
default: default:
exitOnError("Command '%s' not recognized.", command) exitOnError("Command '%s' not recognized.", command)
} }