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
3 changes: 3 additions & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package config

import (
"bytes"
"fmt"
"io"
"net/http"
"os"
Expand Down Expand Up @@ -60,6 +61,7 @@ func TestGetFilePermission(t *testing.T) {
fi := mockFileInfo{mode: m}
err := getFilePermission(fi)
assert.Error(t, err, "Mode %v should be invalid on Windows", m)
assert.EqualError(t, err, fmt.Sprintf("config file has incorrect permission flags: %s, change the file permission either to 0444 or 0666", m.String()))
}
} else {
validModes := []os.FileMode{0600, 0400}
Expand All @@ -74,6 +76,7 @@ func TestGetFilePermission(t *testing.T) {
fi := mockFileInfo{mode: m}
err := getFilePermission(fi)
assert.Error(t, err, "Mode %v should be invalid on UNIX", m)
assert.EqualError(t, err, fmt.Sprintf("config file has incorrect permission flags: %s, change the file permission either to 0400 or 0600", m.String()))
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/config/file_permission_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ func getFilePermission(fi os.FileInfo) error {
if fi.Mode().Perm() == 0o600 || fi.Mode().Perm() == 0o400 {
return nil
}
return fmt.Errorf("config file has incorrect permission flags:%s."+
"change the file permission either to 0400 or 0600.", fi.Mode().Perm().String())
return fmt.Errorf("config file has incorrect permission flags: %s, change the file permission either to 0400 or 0600", fi.Mode().Perm().String())
Comment thread
ish-g09 marked this conversation as resolved.
}
3 changes: 1 addition & 2 deletions pkg/config/file_permission_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ func getFilePermission(fi os.FileInfo) error {
if fi.Mode().Perm() == 0666 || fi.Mode().Perm() == 0444 {
return nil
}
return fmt.Errorf("config file has incorrect permission flags:%s."+
"change the file permission either to 0444 or 0666.", fi.Mode().Perm().String())
return fmt.Errorf("config file has incorrect permission flags: %s, change the file permission either to 0444 or 0666", fi.Mode().Perm().String())
Comment thread
ish-g09 marked this conversation as resolved.
}
Loading