Skip to content

Commit

Permalink
always output filename if we use --return option
Browse files Browse the repository at this point in the history
  • Loading branch information
syou6162 committed Oct 10, 2017
1 parent bc52fa0 commit a284ee8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions check-log/lib/check-log.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type logOpts struct {
WarnLevel float64 `long:"warning-level" value-name:"N" description:"Warning level if pattern has a group"`
CritLevel float64 `long:"critical-level" value-name:"N" description:"Critical level if pattern has a group"`
ReturnContent bool `short:"r" long:"return" description:"Return matched line"`
ReturnFileNames bool `long:"return-filenames" description:"Return matched file names"`
FilePattern string `short:"F" long:"file-pattern" value-name:"FILE" description:"Check a pattern of files, instead of one file"`
CaseInsensitive bool `short:"i" long:"icase" description:"Run a case insensitive match"`
StateDir string `short:"s" long:"state-dir" value-name:"DIR" description:"Dir to keep state files under"`
Expand Down Expand Up @@ -176,11 +175,8 @@ func run(args []string) *checkers.Checker {
}
warnNum += w
critNum += c
if opts.ReturnFileNames && errLines != "" {
errorOverall += "[" + f + "]\n"
}
if opts.ReturnContent {
errorOverall += errLines
if opts.ReturnContent && errLines != "" {
errorOverall += "[" + f + "]\n" + errLines
}
}

Expand Down

0 comments on commit a284ee8

Please sign in to comment.