gofumpt against remaining go files

This commit is contained in:
2022-10-23 23:28:14 -07:00
parent 33828cf7b9
commit 5da4924315
4 changed files with 8 additions and 13 deletions

View File

@@ -36,5 +36,5 @@ var (
// Something in the stderr output contains the word `Failed`, but it is not a known case
// This is a catch-all, and if it's ever seen in the wild, please submit a PR
ErrUnspecified = errors.New("Unknown error, please submit an issue at github.com/taigrr/systemctl")
ErrUnspecified = errors.New("unknown error, please submit an issue at github.com/taigrr/systemctl")
)

View File

@@ -53,7 +53,6 @@ func TestErrorFuncs(t *testing.T) {
fName := runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name()
fName = strings.TrimPrefix(fName, "github.com/taigrr/")
t.Run(fmt.Sprintf("Errorcheck %s", fName), func(t *testing.T) {
for _, tc := range errCases {
t.Run(fmt.Sprintf("%s as %s", tc.unit, userString), func(t *testing.T) {
if (userString == "root" || userString == "system") && tc.runAsUser {

View File

@@ -13,7 +13,6 @@ const dateFormat = "Mon 2006-01-02 15:04:05 MST"
// Get start time of a service (`systemctl show [unit] --property ExecMainStartTimestamp`) as a `Time` type
func GetStartTime(ctx context.Context, unit string, opts Options) (time.Time, error) {
value, err := Show(ctx, unit, properties.ExecMainStartTimestamp, opts)
if err != nil {
return time.Time{}, err
}

View File

@@ -90,8 +90,8 @@ func TestGetStartTime(t *testing.T) {
t.Errorf("Expected start diff to be positive, but got: %d", int(diff))
}
})
}
func TestGetNumRestarts(t *testing.T) {
testCases := []struct {
unit string
@@ -170,7 +170,6 @@ func TestGetNumRestarts(t *testing.T) {
t.Errorf("Expected restart count to differ by one, but difference was: %d", secondRestarts-restarts)
}
})
}
func TestGetMemoryUsage(t *testing.T) {
@@ -230,8 +229,8 @@ func TestGetMemoryUsage(t *testing.T) {
t.Errorf("Expected memory usage between nginx and user.slice to differ, but both were: %d", bytes)
}
})
}
func TestGetPID(t *testing.T) {
testCases := []struct {
unit string
@@ -296,7 +295,5 @@ func TestGetPID(t *testing.T) {
if pid == secondPid {
t.Errorf("Expected pid != secondPid, but both were: %d", pid)
}
})
}