File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ #
3+ # An example hook script to verify what is about to be committed.
4+ # Called by "git commit" with no arguments. The hook should
5+ # exit with non-zero status after issuing an appropriate message if
6+ # it wants to stop the commit.
7+ #
8+ # To enable this hook, rename this file to "pre-commit".
9+
10+ echo " Running lint check"
11+ output=$( golint pkg/... cmd/...)
12+ if [ -z " $output " ]
13+ then
14+ echo " Lint passed!"
15+ else
16+ echo " $output "
17+ echo " LINT FAILED!"
18+ exit 1
19+ fi
20+
21+ echo " Checking dependency"
22+ output=$( grep replace go.mod)
23+ if [ -n " $output " ]
24+ then
25+ echo " Failed: found using local module"
26+ exit 1
27+ else
28+ echo " Passed dep check"
29+ fi
Original file line number Diff line number Diff line change 1+ name : Build
2+
3+ on : push
4+
5+ jobs :
6+ build-go :
7+ strategy :
8+ matrix :
9+ go-version : [1.14.x, 1.15.x]
10+ os : [ubuntu-latest, macos-latest, windows-latest]
11+ runs-on : ${{ matrix.os }}
12+ steps :
13+ - name : Install Go
14+ uses : actions/setup-go@v2
15+ with :
16+ go-version : ${{ matrix.go-version }}
17+
18+ - name : Create Cache
19+ uses : actions/cache@v2
20+ with :
21+ path : ~/go/pkg/mod
22+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
23+ restore-keys : |
24+ ${{ runner.os }}-go-
25+ - name : Checkout code
26+ uses : actions/checkout@v2
27+ - name : build
28+ run : go build
29+ if : steps.cache.outputs.cache-hit != 'true'
Original file line number Diff line number Diff line change 1+ name : Lint
2+
3+ on : push
4+
5+ jobs :
6+ lint :
7+ name : lint
8+ runs-on : ubuntu-latest
9+ steps :
10+ - uses : actions/checkout@v2
11+ - name : golangci-lint
12+ uses : golangci/golangci-lint-action@v2
13+ with :
14+ version : v1.29
Original file line number Diff line number Diff line change 1+ name : Release
2+
3+ on :
4+ release :
5+ types : [published]
6+
7+ jobs :
8+ release-bins :
9+ name : Release Go Binary
10+ runs-on : ubuntu-latest
11+ strategy :
12+ matrix :
13+ goos : [linux, windows, darwin]
14+ goarch : [amd64]
15+ steps :
16+ - uses : actions/checkout@v2
17+ - uses : wangyoucao577/go-release-action@master
18+ with :
19+ github_token : ${{ secrets.GITHUB_TOKEN }}
20+ goos : ${{ matrix.goos }}
21+ goarch : ${{ matrix.goarch }}
22+ goversion : " 1.15"
23+ extra_files : LICENSE README.md
Original file line number Diff line number Diff line change 44 cd ${module} && go test -v github.com/openopsdev/go-cli-commons/...
55
66lint :
7- go get -u golang.org/x/lint/golint
8- test -z " $$ (golint ./...)"
7+ golangci-lint run
98
109local-module :
1110 echo " replace github.com/openopsdev/go-cli-commons/$( module) => ../go-cli-commons/$( module) " >> go.mod
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package logger
22
33import (
44 "fmt"
5+ "os"
56
67 "github.com/gookit/color"
78)
Original file line number Diff line number Diff line change 11package prompts
22
33import (
4- "fmt"
5- "os"
4+ "github.com/openopsdev/go-cli-commons/logger"
65)
76
87// CLIInput -
@@ -16,15 +15,14 @@ type Prompts map[string]CLIInput
1615// Answers -
1716type Answers map [string ]string
1817
19- // Run - starts the run
18+ // Run - starts the run
2019func (p Prompts ) Run () Answers {
2120 answers := Answers {}
2221
2322 for key , input := range p {
2423 a , err := input .Run ()
2524 if err != nil {
26- log .Errorf ("error with prompt: %v" , err )
27- os .Exit (1 )
25+ logger .Fatal (err .Error ())
2826 }
2927 answers [key ] = a
3028 }
You can’t perform that action at this time.
0 commit comments