Skip to content

Commit 6d6a05a

Browse files
authored
Merge pull request #22 from takecy/ci
Add linter in actions
2 parents bd5ca4d + ead3973 commit 6d6a05a

File tree

11 files changed

+74
-185
lines changed

11 files changed

+74
-185
lines changed

.github/workflows/release.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ jobs:
1111
uses: actions/checkout@v2
1212
with:
1313
fetch-depth: 0
14+
1415
- name: Setup Go
15-
uses: actions/setup-go@v2
16+
uses: actions/setup-go@v3
1617
with:
1718
go-version: 1.19
19+
1820
- name: Run GoReleaser
1921
uses: goreleaser/goreleaser-action@v2
2022
with:
21-
version: latest
23+
version: v3.1.0
2224
args: release --rm-dist
2325
env:
2426
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tagging.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Bump version
2+
on:
3+
push:
4+
branches:
5+
- master
6+
workflow_dispatch:
7+
8+
jobs:
9+
tagging:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 2
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Bump version and push tag
15+
uses: mathieudutour/github-tag-action@v5.5
16+
with:
17+
github_token: ${{ secrets.GITHUB_TOKEN }}
18+
release_branches: master
19+
tag_prefix: "v"

.github/workflows/unittest.yml

+5
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,10 @@ jobs:
2323
go-version: ${{ matrix.go-version }}
2424
id: go
2525

26+
- name: golangci-lint
27+
uses: golangci/golangci-lint-action@v3
28+
with:
29+
version: v1.50.0
30+
2631
- name: Run test
2732
run: go test -v -race ./...

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: build install update restore tidy update_all outdated
1+
.PHONY: build install update restore tidy update_all
22

33
build:
44
go build -o gih_dev -ldflags "-X main.version='0.0.1-test'" ./gih
@@ -8,6 +8,9 @@ install:
88

99
update: update_all tidy
1010

11+
lint:
12+
golangci-lint run
13+
1114
restore: tidy
1215

1316
tidy:

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
![unittest](https://github.com/takecy/git-here/workflows/unittest/badge.svg)
88
[![Go Report Card](https://goreportcard.com/badge/github.com/takecy/git-here)](https://goreportcard.com/report/github.com/takecy/git-here)
9-
![](https://img.shields.io/badge/golang-1.18+-blue.svg?style=flat-square)
9+
![](https://img.shields.io/badge/golang-1.19+-blue.svg?style=flat-square)
1010
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/takecy/git-here)
1111
![](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)
1212

@@ -75,7 +75,7 @@ Options:
7575

7676
## Development
7777

78-
* Go 1.18+
78+
* Go 1.19+
7979

8080
#### Why this repository have vendor?
8181
It is to simplify development. You can start right away just by cloning.

gih/main.go

+1-64
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,13 @@ import (
66
"os"
77
"runtime"
88

9-
"github.com/blang/semver"
10-
"github.com/rhysd/go-github-selfupdate/selfupdate"
119
"github.com/takecy/git-here/printer"
1210
"github.com/takecy/git-here/syncer"
1311
)
1412

1513
// set by build
1614
var (
17-
version = "0.13.4"
18-
commit = "unset"
19-
date = "unset"
20-
builtBy = "unset"
15+
version = "0.13.11"
2116
goversion = "1.19.1"
2217
)
2318

@@ -60,7 +55,6 @@ func main() {
6055
}
6156

6257
if flag.Arg(0) == "version" {
63-
// checkUpdate()
6458
fmt.Fprintf(os.Stdout, "git-here %s\n", version)
6559
fmt.Fprintf(os.Stdout, "go version %s\n", goversion)
6660
return
@@ -90,60 +84,3 @@ func main() {
9084
panic(err)
9185
}
9286
}
93-
94-
func checkUpdate() {
95-
fmt.Printf("checking latest version...\n")
96-
repo := "takecy/git-here"
97-
updater, err := selfupdate.NewUpdater(selfupdate.Config{
98-
APIToken: "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", // read only of public info
99-
})
100-
if err != nil {
101-
fmt.Printf("Check update failed: %v\n", err)
102-
return
103-
}
104-
105-
latest, found, err := updater.DetectLatest(repo)
106-
if err != nil {
107-
fmt.Printf("Binary update failed: %v\n", err)
108-
return
109-
}
110-
111-
fmt.Printf("the latest version is %s (%s)\n", latest.Version, latest.PublishedAt.Format("2006-01-02"))
112-
113-
v, err := semver.Parse(version)
114-
if err != nil {
115-
fmt.Printf("err: parse version failed: %v\n", err)
116-
return
117-
}
118-
if !found || latest.Version.LTE(v) {
119-
fmt.Printf("Current version is the latest:\nversion: %s\nsha: %s\ndate:%s\n", version, commit, date)
120-
return
121-
}
122-
123-
fmt.Printf("Do you want to update to [%s] ? (y/n): \n", latest.Version)
124-
input := ""
125-
_, err = fmt.Scanln(&input)
126-
if err != nil {
127-
fmt.Printf("Invalid input\n")
128-
return
129-
}
130-
131-
switch input {
132-
case "y":
133-
fmt.Printf("updating....\n")
134-
// next
135-
case "n":
136-
fmt.Printf("not update.\n")
137-
return
138-
default:
139-
fmt.Printf("invalid input.\n")
140-
return
141-
}
142-
143-
updated, err := updater.UpdateSelf(v, repo)
144-
if err != nil {
145-
fmt.Printf("Error occurred while updating binary: %v\n", err)
146-
return
147-
}
148-
fmt.Printf("Successfully updated to version: %s\n", updated.Version)
149-
}

go.mod

+2-16
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,14 @@ module github.com/takecy/git-here
33
go 1.19
44

55
require (
6-
github.com/blang/semver v3.5.1+incompatible
76
github.com/fatih/color v1.13.0
87
github.com/matryer/is v1.4.0
98
github.com/pkg/errors v0.9.1
10-
github.com/rhysd/go-github-selfupdate v1.2.3
11-
golang.org/x/sync v0.0.0-20220907140024-f12130a52804
9+
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0
1210
)
1311

1412
require (
15-
github.com/golang/protobuf v1.5.2 // indirect
16-
github.com/google/go-github/v30 v30.1.0 // indirect
17-
github.com/google/go-querystring v1.1.0 // indirect
18-
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf // indirect
1913
github.com/mattn/go-colorable v0.1.13 // indirect
2014
github.com/mattn/go-isatty v0.0.16 // indirect
21-
github.com/tcnksm/go-gitconfig v0.1.2 // indirect
22-
github.com/ulikunitz/xz v0.5.10 // indirect
23-
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
24-
golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect
25-
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 // indirect
26-
golang.org/x/sys v0.0.0-20220915200043-7b5979e65e41 // indirect
27-
google.golang.org/appengine v1.6.7 // indirect
28-
google.golang.org/protobuf v1.28.1 // indirect
29-
gopkg.in/yaml.v2 v2.4.0 // indirect
15+
golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43 // indirect
3016
)

go.sum

+4-78
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,5 @@
1-
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
2-
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
31
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
42
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
5-
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
6-
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
7-
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
8-
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
9-
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
10-
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
11-
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
12-
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
13-
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
14-
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
15-
github.com/google/go-github/v30 v30.1.0 h1:VLDx+UolQICEOKu2m4uAoMti1SxuEBAl7RSEG16L+Oo=
16-
github.com/google/go-github/v30 v30.1.0/go.mod h1:n8jBpHl45a/rlBUtRJMOG4GhNADUQFEufcolZ95JfU8=
17-
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
18-
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
19-
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
20-
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
21-
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf h1:WfD7VjIE6z8dIvMsI4/s+1qr5EL+zoIGev1BQj1eoJ8=
22-
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf/go.mod h1:hyb9oH7vZsitZCiBt0ZvifOrB+qc8PS5IiilCIb87rg=
23-
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
24-
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
25-
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
263
github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=
274
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
285
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
@@ -32,64 +9,13 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky
329
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
3310
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
3411
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
35-
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
36-
github.com/onsi/gomega v1.4.2 h1:3mYCb7aPxS/RU7TI1y4rkEn1oKmPRjNJLNEXgw7MH2I=
37-
github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
3812
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
3913
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
40-
github.com/rhysd/go-github-selfupdate v1.2.3 h1:iaa+J202f+Nc+A8zi75uccC8Wg3omaM7HDeimXA22Ag=
41-
github.com/rhysd/go-github-selfupdate v1.2.3/go.mod h1:mp/N8zj6jFfBQy/XMYoWsmfzxazpPAODuqarmPDe2Rg=
42-
github.com/tcnksm/go-gitconfig v0.1.2 h1:iiDhRitByXAEyjgBqsKi9QU4o2TNtv9kPP3RgPgXBPw=
43-
github.com/tcnksm/go-gitconfig v0.1.2/go.mod h1:/8EhP4H7oJZdIPyT+/UIsG87kTzrzM4UsLGSItWYCpE=
44-
github.com/ulikunitz/xz v0.5.9/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
45-
github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8=
46-
github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
47-
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
48-
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
49-
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 h1:Y/gsMcFOcR+6S6f3YeMKl5g+dZMEWqcz5Czj/GWYbkM=
50-
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
51-
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
52-
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
53-
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
54-
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
55-
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
56-
golang.org/x/net v0.0.0-20220909164309-bea034e7d591 h1:D0B/7al0LLrVC8aWF4+oxpv/m8bc7ViFfVS8/gXGdqI=
57-
golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
58-
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
59-
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
60-
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 h1:lxqLZaMad/dJHMFZH0NiNpiEZI/nhgWhe4wgzpE+MuA=
61-
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg=
62-
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
63-
golang.org/x/sync v0.0.0-20220907140024-f12130a52804 h1:0SH2R3f1b1VmIMG7BXbEZCBUu2dKmHschSmjqGUrW8A=
64-
golang.org/x/sync v0.0.0-20220907140024-f12130a52804/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
65-
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
66-
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
67-
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
14+
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 h1:cu5kTvlzcw1Q5S9f5ip1/cpiB4nXvw1XYzFPGgzLUOY=
15+
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
6816
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
6917
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
7018
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
7119
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
72-
golang.org/x/sys v0.0.0-20220915200043-7b5979e65e41 h1:ohgcoMbSofXygzo6AD2I1kz3BFmW1QArPYTtwEM3UXc=
73-
golang.org/x/sys v0.0.0-20220915200043-7b5979e65e41/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
74-
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
75-
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
76-
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
77-
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
78-
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
79-
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
80-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
81-
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
82-
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
83-
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
84-
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
85-
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
86-
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
87-
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
88-
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
89-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
90-
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
91-
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
92-
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
93-
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
94-
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
95-
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
20+
golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43 h1:OK7RB6t2WQX54srQQYSXMW8dF5C6/8+oA/s5QBmmto4=
21+
golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

printer/print.go

+25-12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package printer
22

33
import (
44
"io"
5+
"log"
56
"os"
67
"strings"
78
"text/template"
@@ -78,8 +79,10 @@ func (p *Printer) PrintCmd(cmd string, options []string) {
7879
Ops string
7980
}
8081
t := template.Must(template.New("item").Funcs(helpers).Parse(cmdTmpl))
81-
t.Execute(p.writer, cmds{Cmd: cmd, Ops: strings.Join(options, " ")})
82-
return
82+
err := t.Execute(p.writer, cmds{Cmd: cmd, Ops: strings.Join(options, " ")})
83+
if err != nil {
84+
log.Println(err)
85+
}
8386
}
8487

8588
// PrintMsg prints message
@@ -88,8 +91,10 @@ func (p *Printer) PrintMsg(msg string) {
8891
Msg string
8992
}
9093
t := template.Must(template.New("msg").Funcs(helpers).Parse(msgTmpl))
91-
t.Execute(p.writer, message{Msg: msg})
92-
return
94+
err := t.Execute(p.writer, message{Msg: msg})
95+
if err != nil {
96+
log.Println(err)
97+
}
9398
}
9499

95100
// PrintMsgErr prints error message
@@ -98,8 +103,10 @@ func (p *Printer) PrintMsgErr(msg string) {
98103
Msg string
99104
}
100105
t := template.Must(template.New("msg").Funcs(helpers).Parse(msgErrTmpl))
101-
t.Execute(p.writer, message{Msg: msg})
102-
return
106+
err := t.Execute(p.writer, message{Msg: msg})
107+
if err != nil {
108+
log.Println(err)
109+
}
103110
}
104111

105112
// PrintRepoErr prints error message
@@ -109,21 +116,27 @@ func (p *Printer) PrintRepoErr(msg string, repos []string) {
109116
Repos []string
110117
}
111118
t := template.Must(template.New("msg").Funcs(helpers).Parse(repoErrTmpl))
112-
t.Execute(p.writer, message{Msg: msg, Repos: repos})
113-
return
119+
err := t.Execute(p.writer, message{Msg: msg, Repos: repos})
120+
if err != nil {
121+
log.Println(err)
122+
}
114123
}
115124

116125
// Print prints result
117126
func (p *Printer) Print(res Result) {
118-
t(true).Execute(p.writer, res)
119-
return
127+
err := t(true).Execute(p.writer, res)
128+
if err != nil {
129+
log.Println(err)
130+
}
120131
}
121132

122133
// Error prints error
123134
func (p *Printer) Error(res Result) {
124135
res.Msg = res.Err.Error()
125-
t(false).Execute(p.errWriter, res)
126-
return
136+
err := t(false).Execute(p.errWriter, res)
137+
if err != nil {
138+
log.Println(err)
139+
}
127140
}
128141

129142
func t(isSuccess bool) *template.Template {

0 commit comments

Comments
 (0)