Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions flagrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"io"
"os"
"path/filepath"
"reflect"
"runtime"
"runtime/debug"
Expand Down Expand Up @@ -211,15 +212,18 @@ func (f *Flagrun) internalChecker(
if chk == nil {
return "UNKNOWN: checker returned nil", UNKNOWN
}
if chk.Name == "" {
chk.Name = filepath.Base(os.Args[0])
}
switch chk.Status {
case checkers.OK:
return chk.String(), OK
return chk.String(), OK
case checkers.WARNING:
return chk.String(), WARNING
return chk.String(), WARNING
case checkers.CRITICAL:
return chk.String(), CRITICAL
return chk.String(), CRITICAL
default:
return chk.String(), UNKNOWN
return chk.String(), UNKNOWN
}
}

Expand Down
2 changes: 1 addition & 1 deletion flagrun_check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestInternalChecker(t *testing.T) {
stdoutStr := stdout.String()

assert.Equal(t, "", stdoutStr)
assert.Equal(t, tt.wantStdout, msg)
assert.Equal(t, "flagrun.test"+tt.wantStdout, msg)
assert.Equal(t, tt.wantCode, code)
})
}
Expand Down