Skip to content

Commit 6bffa78

Browse files
[test] build failure due to non-constant format string in fmt.Errorf
1 parent e24fab5 commit 6bffa78

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pkg/daemon/fake/winsvc.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (f *FakeService) Control(cmd svc.Cmd) (svc.Status, error) {
6363
for _, serviceName := range existingServices {
6464
service, present := f.serviceList.read(serviceName)
6565
if !present {
66-
return svc.Status{}, fmt.Errorf("unable to open service " + serviceName)
66+
return svc.Status{}, fmt.Errorf("unable to open service %s", serviceName)
6767
}
6868
config, err := service.Config()
6969
if err != nil {
@@ -77,8 +77,8 @@ func (f *FakeService) Control(cmd svc.Cmd) (svc.Status, error) {
7777
return svc.Status{}, fmt.Errorf("error querying %s service status: %w", serviceName, err)
7878
}
7979
if status.State != svc.Stopped {
80-
return svc.Status{}, fmt.Errorf("cannot stop service as other service " + serviceName +
81-
" is dependent on it")
80+
return svc.Status{}, fmt.Errorf("cannot stop service: %s, as other service is dependent on"+
81+
"it", serviceName)
8282
}
8383
}
8484
}

test/e2e/validation_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ func (tc *testContext) getWinServices(addr string) (map[string]winService, error
465465
// Remove the header and trailing whitespace from the command output
466466
outSplit := strings.SplitAfterN(out, "\"Name\",\"State\",\"Description\"\r\n", 2)
467467
if len(outSplit) != 2 {
468-
return nil, fmt.Errorf("unexpected command output: " + out)
468+
return nil, fmt.Errorf("unexpected command output: %s", out)
469469
}
470470
trimmedList := strings.TrimSpace(outSplit[1])
471471

@@ -476,7 +476,7 @@ func (tc *testContext) getWinServices(addr string) (map[string]winService, error
476476
// Split into 3 substrings, Name, State, Description. The description can contain a comma, so SplitN is required
477477
fields := strings.SplitN(line, ",", 3)
478478
if len(fields) != 3 {
479-
return nil, fmt.Errorf("expected comma separated values, found: " + line)
479+
return nil, fmt.Errorf("expected comma separated values, found: %s", line)
480480
}
481481
name := strings.Trim(fields[0], "\"")
482482
state := strings.Trim(fields[1], "\"")

0 commit comments

Comments
 (0)