Skip to content

Commit

Permalink
*: fix lint issue
Browse files Browse the repository at this point in the history
Signed-off-by: Wei Fu <[email protected]>
  • Loading branch information
fuweid committed Mar 28, 2024
1 parent b392b8c commit c684725
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion contrib/cmd/runkperf/commands/ekswarmup/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func deployWarmupRunnerGroup(ctx context.Context, kubeCfgPath string, runnerImag
if err != nil {
return fmt.Errorf("failed to create temporary file for %s: %w", target, err)
}
defer cleanup()
defer func() { _ = cleanup() }()

kr := utils.NewKperfRunner(kubeCfgPath, runnerImage)

Expand Down
11 changes: 4 additions & 7 deletions contrib/internal/mountns/ns.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,17 @@ func Executes(run func() error) error {
wg.Add(1)

var innerErr error
go func() (retErr error) {
go func() {
defer wg.Done()

defer func() {
innerErr = retErr
}()

runtime.LockOSThread()

err := unix.Unshare(unix.CLONE_FS | unix.CLONE_NEWNS)
if err != nil {
return fmt.Errorf("failed to create a new mount namespace: %w", err)
innerErr = fmt.Errorf("failed to create a new mount namespace: %w", err)
return
}
return run()
innerErr = run()
}()
wg.Wait()

Expand Down
2 changes: 1 addition & 1 deletion contrib/internal/utils/kubectl_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (kr *KubectlRunner) Metrics(ctx context.Context, timeout time.Duration, fqd
if err != nil {
return err
}
defer cleanup()
defer func() { _ = cleanup() }()

target := "/etc/hosts"

Expand Down
4 changes: 2 additions & 2 deletions contrib/internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func RepeatJobWith3KPod(ctx context.Context, kubeCfgPath string, namespace strin
if err != nil {
panic(fmt.Errorf("unexpected error when create job yaml: %v", err))
}
defer cleanup()
defer func() { _ = cleanup() }()

kr := NewKubectlRunner(kubeCfgPath, namespace)

Expand Down Expand Up @@ -120,7 +120,7 @@ func CreateTempFileWithContent(data []byte) (_name string, _cleanup func() error
fName := f.Name()
defer func() {
if retErr != nil {
os.RemoveAll(fName)
_ = os.RemoveAll(fName)
}
}()

Expand Down

0 comments on commit c684725

Please sign in to comment.