Skip to content

Commit

Permalink
Fix reviewdog
Browse files Browse the repository at this point in the history
  • Loading branch information
nao1215 committed Apr 16, 2022
1 parent c6ff23c commit 77f319c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ func makeBashCompletionFileIfNeeded(cmd *cobra.Command) {

path := completion.BashCompletionFilePath()
bashCompletion := new(bytes.Buffer)
cmd.GenBashCompletion(bashCompletion)
if err := cmd.GenBashCompletion(bashCompletion); err != nil {
print.Err(fmt.Errorf("can not generate bash completion content: %w", err))
return
}

if !file.IsFile(path) {
fp, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE, 0664)
Expand Down Expand Up @@ -172,7 +175,9 @@ func hasSameBashCompletionContent(cmd *cobra.Command) bool {
}

currentBashCompletion := new(bytes.Buffer)
cmd.GenBashCompletion(currentBashCompletion)
if err := cmd.GenBashCompletion(currentBashCompletion); err != nil {
return false
}
if !strings.Contains(string(bashCompletionFileInLocal), currentBashCompletion.String()) {
return false
}
Expand Down

0 comments on commit 77f319c

Please sign in to comment.