Skip to content

Commit 3fb475a

Browse files
committed
CI: use gosumcheck to check exclusiveness of switch-case
https://github.com/haya14busa/gosum
1 parent 8b158bc commit 3fb475a

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ install:
1010
- go get github.com/golang/lint/golint
1111
- go get honnef.co/go/unused/cmd/unused
1212
- go get github.com/haya14busa/goverage
13+
- go get github.com/haya14busa/gosum/cmd/gosumcheck
1314

1415
before_script:
1516
- vim --cmd version --cmd quit
@@ -19,6 +20,7 @@ script:
1920
- goverage -coverprofile=coverage.txt ./...
2021
- vim -u NONE -N --cmd "let &rtp .= ',' . getcwd()" -S go/generate.vim -c ":q"
2122
- (! git diff | grep '^') # check diff
23+
- gosumcheck ./...
2224

2325
after_success:
2426
- bash <(curl -s https://codecov.io/bash)

compiler/compiler.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ func (c *Compiler) compileExcommand(node ast.ExCommand) error {
135135
c.compileEchohl(n)
136136
case *ast.Execute:
137137
c.compileExecute(n)
138+
case *ast.EndFor, *ast.EndIf, *ast.Finally, *ast.EndFunction, *ast.EndTry,
139+
*ast.EndWhile, *ast.Catch, *ast.Else, *ast.ElseIf:
140+
return fmt.Errorf("compileExcommand: unexpected Node: %v", n)
138141
}
139142
return nil
140143
}

0 commit comments

Comments
 (0)