chore: various cosmetic changes.
This commit is contained in:
parent
256d4abde8
commit
aea0034fcc
16 changed files with 35 additions and 32 deletions
|
|
@ -69,7 +69,8 @@ func GetJournalctlLogs(path string, useFile bool) (io.Reader, error) {
|
|||
return strings.NewReader(res), nil
|
||||
}
|
||||
|
||||
func GetLogFile(path string) string {
|
||||
// SelectLogFile return the path of the available log file to parse (audit, syslog, .1, .2)
|
||||
func SelectLogFile(path string) string {
|
||||
info, err := os.Stat(filepath.Clean(path))
|
||||
if err == nil && !info.IsDir() {
|
||||
return path
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ func TestGetJournalctlLogs(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestGetLogFile(t *testing.T) {
|
||||
func TestSelectLogFile(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
path string
|
||||
|
|
@ -77,7 +77,7 @@ func TestGetLogFile(t *testing.T) {
|
|||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := GetLogFile(tt.path); got != tt.want {
|
||||
if got := SelectLogFile(tt.path); got != tt.want {
|
||||
t.Errorf("getLogFile() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue