File tree Expand file tree Collapse file tree 4 files changed +21
-37
lines changed
Expand file tree Collapse file tree 4 files changed +21
-37
lines changed Original file line number Diff line number Diff line change 11name : tests
22on : [push, pull_request]
33jobs :
4-
54 build :
65 name : Build
76 runs-on : ubuntu-latest
87 steps :
9-
10- - name : Set up Go 1.12
8+ - name : Set up Go 1.14
119 uses : actions/setup-go@v1
1210 with :
13- go-version : 1.13.1
11+ go-version : 1.14.3
1412 id : go
1513
1614 - name : Check out code into the Go module directory
1715 uses : actions/checkout@v1
1816
19- - name : Build
20- run : go build -v cmd/tickgit.go
17+ - name : Vet
18+ run : go vet -v ./...
2119
2220 - name : Test
2321 run : go test -v ./...
22+
23+ lint :
24+ name : Lint
25+ runs-on : ubuntu-latest
26+ steps :
27+ - uses : actions/checkout@v2
28+ - name : golangci-lint
29+ uses : golangci/golangci-lint-action@v1
30+ with :
31+ version : v1.26
Original file line number Diff line number Diff line change @@ -97,7 +97,8 @@ var todosCmd = &cobra.Command{
9797 handleError (err , s )
9898
9999 } else {
100- todos .WriteTodos (foundToDos , os .Stdout )
100+ err := todos .WriteTodos (foundToDos , os .Stdout )
101+ handleError (err , s )
101102 }
102103
103104 },
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ func SearchCommit(commit *object.Commit, cb func(*Comment)) error {
116116 return err
117117 }
118118 defer fileIter .Close ()
119- fileIter .ForEach (func (file * object.File ) error {
119+ err = fileIter .ForEach (func (file * object.File ) error {
120120 if file .Mode .IsFile () {
121121 wg .Add (1 )
122122 go func () {
@@ -138,6 +138,10 @@ func SearchCommit(commit *object.Commit, cb func(*Comment)) error {
138138 return nil
139139 })
140140
141+ if err != nil {
142+ return err
143+ }
144+
141145 wg .Wait ()
142146 return nil
143147}
Original file line number Diff line number Diff line change 11package todos
22
33import (
4- "bufio"
54 "context"
65 "strings"
76
87 "github.com/augmentable-dev/tickgit/pkg/blame"
98 "github.com/augmentable-dev/tickgit/pkg/comments"
109 "github.com/dustin/go-humanize"
11- "gopkg.in/src-d/go-git.v4/plumbing/object"
1210)
1311
1412// ToDo represents a ToDo item
@@ -100,33 +98,6 @@ func (t ToDos) CountWithCommits() (count int) {
10098 return count
10199}
102100
103- func (t * ToDo ) existsInCommit (commit * object.Commit ) (bool , error ) {
104- f , err := commit .File (t .FilePath )
105- if err != nil {
106- if err == object .ErrFileNotFound {
107- return false , nil
108- }
109- return false , err
110- }
111- r , err := f .Reader ()
112- if err != nil {
113- return false , err
114- }
115- defer r .Close ()
116- s := bufio .NewScanner (r )
117- for s .Scan () {
118- line := s .Text ()
119- if strings .Contains (line , t .Comment .String ()) {
120- return true , nil
121- }
122- }
123- err = s .Err ()
124- if err != nil {
125- return false , err
126- }
127- return false , nil
128- }
129-
130101// FindBlame sets the blame information on each todo in a set of todos
131102func (t * ToDos ) FindBlame (ctx context.Context , dir string ) error {
132103 fileMap := make (map [string ]ToDos )
You can’t perform that action at this time.
0 commit comments