Skip to content

Commit 5da4924

Browse files
committed
gofumpt against remaining go files
1 parent 33828cf commit 5da4924

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ var (
3636

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

errors_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestErrorFuncs(t *testing.T) {
2525
}{
2626
/* Run these tests only as an unpriviledged user */
2727

28-
//try nonexistant unit in user mode as user
28+
// try nonexistant unit in user mode as user
2929
{"nonexistant", ErrDoesNotExist, Options{UserMode: true}, true},
3030
// try existing unit in user mode as user
3131
{"syncthing", nil, Options{UserMode: true}, true},
@@ -53,7 +53,6 @@ func TestErrorFuncs(t *testing.T) {
5353
fName := runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name()
5454
fName = strings.TrimPrefix(fName, "github.com/taigrr/")
5555
t.Run(fmt.Sprintf("Errorcheck %s", fName), func(t *testing.T) {
56-
5756
for _, tc := range errCases {
5857
t.Run(fmt.Sprintf("%s as %s", tc.unit, userString), func(t *testing.T) {
5958
if (userString == "root" || userString == "system") && tc.runAsUser {

helpers.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const dateFormat = "Mon 2006-01-02 15:04:05 MST"
1313
// Get start time of a service (`systemctl show [unit] --property ExecMainStartTimestamp`) as a `Time` type
1414
func GetStartTime(ctx context.Context, unit string, opts Options) (time.Time, error) {
1515
value, err := Show(ctx, unit, properties.ExecMainStartTimestamp, opts)
16-
1716
if err != nil {
1817
return time.Time{}, err
1918
}

helpers_test.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestGetStartTime(t *testing.T) {
2727
runAsUser bool
2828
}{
2929
// Run these tests only as a user
30-
//try nonexistant unit in user mode as user
30+
// try nonexistant unit in user mode as user
3131
{"nonexistant", ErrUnitNotActive, Options{UserMode: false}, true},
3232
// try existing unit in user mode as user
3333
{"syncthing", ErrUnitNotActive, Options{UserMode: true}, true},
@@ -90,8 +90,8 @@ func TestGetStartTime(t *testing.T) {
9090
t.Errorf("Expected start diff to be positive, but got: %d", int(diff))
9191
}
9292
})
93-
9493
}
94+
9595
func TestGetNumRestarts(t *testing.T) {
9696
testCases := []struct {
9797
unit string
@@ -101,7 +101,7 @@ func TestGetNumRestarts(t *testing.T) {
101101
}{
102102
// Run these tests only as a user
103103

104-
//try nonexistant unit in user mode as user
104+
// try nonexistant unit in user mode as user
105105
{"nonexistant", ErrValueNotSet, Options{UserMode: false}, true},
106106
// try existing unit in user mode as user
107107
{"syncthing", ErrValueNotSet, Options{UserMode: true}, true},
@@ -170,7 +170,6 @@ func TestGetNumRestarts(t *testing.T) {
170170
t.Errorf("Expected restart count to differ by one, but difference was: %d", secondRestarts-restarts)
171171
}
172172
})
173-
174173
}
175174

176175
func TestGetMemoryUsage(t *testing.T) {
@@ -182,7 +181,7 @@ func TestGetMemoryUsage(t *testing.T) {
182181
}{
183182
// Run these tests only as a user
184183

185-
//try nonexistant unit in user mode as user
184+
// try nonexistant unit in user mode as user
186185
{"nonexistant", ErrValueNotSet, Options{UserMode: false}, true},
187186
// try existing unit in user mode as user
188187
{"syncthing", ErrValueNotSet, Options{UserMode: true}, true},
@@ -230,8 +229,8 @@ func TestGetMemoryUsage(t *testing.T) {
230229
t.Errorf("Expected memory usage between nginx and user.slice to differ, but both were: %d", bytes)
231230
}
232231
})
233-
234232
}
233+
235234
func TestGetPID(t *testing.T) {
236235
testCases := []struct {
237236
unit string
@@ -241,7 +240,7 @@ func TestGetPID(t *testing.T) {
241240
}{
242241
// Run these tests only as a user
243242

244-
//try nonexistant unit in user mode as user
243+
// try nonexistant unit in user mode as user
245244
{"nonexistant", nil, Options{UserMode: false}, true},
246245
// try existing unit in user mode as user
247246
{"syncthing", nil, Options{UserMode: true}, true},
@@ -296,7 +295,5 @@ func TestGetPID(t *testing.T) {
296295
if pid == secondPid {
297296
t.Errorf("Expected pid != secondPid, but both were: %d", pid)
298297
}
299-
300298
})
301-
302299
}

0 commit comments

Comments
 (0)