Skip to content

Commit caae228

Browse files
authored
(chore): fix the go fmt of the files (#734)
Signed-off-by: Shubham Chaudhary <[email protected]>
1 parent 34a62d8 commit caae228

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

chaoslib/litmus/stress-chaos/helper/stress-helper.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func prepareStressChaos(experimentsDetails *experimentTypes.ExperimentDetails, c
111111
}
112112

113113
var (
114-
targets []targetDetails
114+
targets []targetDetails
115115
)
116116

117117
for _, t := range targetList.Target {
@@ -504,7 +504,7 @@ func abortWatcher(targets []targetDetails, resultName, chaosNS string) {
504504
func getCGroupManager(t targetDetails) (interface{}, error, string) {
505505
if cgroups.Mode() == cgroups.Unified {
506506
groupPath := ""
507-
output, err := exec.Command("bash", "-c", fmt.Sprintf("nsenter -t 1 -C -m -- cat /proc/%v/cgroup", t.Pids[index])).CombinedOutput()
507+
output, err := exec.Command("bash", "-c", fmt.Sprintf("nsenter -t 1 -C -m -- cat /proc/%v/cgroup", t.Pid)).CombinedOutput()
508508
if err != nil {
509509
return nil, errors.Errorf("Error in getting groupPath,%s", string(output)), ""
510510
}
@@ -518,7 +518,7 @@ func getCGroupManager(t targetDetails) (interface{}, error, string) {
518518

519519
log.Infof("group path: %s", groupPath)
520520

521-
cgroup2, err := cgroupsv2.LoadManager("/sys/fs/cgroup", string(groupPath))
521+
cgroup2, err := cgroupsv2.LoadManager("/sys/fs/cgroup", groupPath)
522522
if err != nil {
523523
return nil, errors.Errorf("Error loading cgroup v2 manager, %v", err), ""
524524
}
@@ -541,7 +541,7 @@ func getCGroupManager(t targetDetails) (interface{}, error, string) {
541541
// By default it will add to v1 cgroup
542542
func addProcessToCgroup(pid int, control interface{}, groupPath string) error {
543543
if cgroups.Mode() == cgroups.Unified {
544-
args := []string{"-t", "1", "-C", "--", "sudo", "sh", "-c", fmt.Sprintf("echo %d >> /sys/fs/cgroup%s/cgroup.procs", pid, strings.ReplaceAll(groupPath, "\n", ""))}
544+
args := []string{"-t", "1", "-C", "--", "sudo", "sh", "-c", fmt.Sprintf("echo %d >> /sys/fs/cgroup%s/cgroup.procs", pid, strings.ReplaceAll(groupPath, "\n", ""))}
545545
output, err := exec.Command("nsenter", args...).CombinedOutput()
546546
if err != nil {
547547
return cerrors.Error{
@@ -555,7 +555,6 @@ func addProcessToCgroup(pid int, control interface{}, groupPath string) error {
555555
return cgroup1.Add(cgroups.Process{Pid: pid})
556556
}
557557

558-
559558
func injectChaos(t targetDetails, stressors, stressType string) (*exec.Cmd, error) {
560559
stressCommand := fmt.Sprintf("pause nsutil -t %v -p -- %v", strconv.Itoa(t.Pid), stressors)
561560
// for io stress,we need to enter into mount ns of the target container
@@ -605,5 +604,5 @@ type targetDetails struct {
605604
CGroupManager interface{}
606605
Cmd *exec.Cmd
607606
Source string
608-
GroupPath string
607+
GroupPath string
609608
}

0 commit comments

Comments
 (0)