Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimized code #4054

Open
feyounger opened this issue Mar 3, 2025 · 1 comment · May be fixed by #4056
Open

Optimized code #4054

feyounger opened this issue Mar 3, 2025 · 1 comment · May be fixed by #4056
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@feyounger
Copy link

What is the problem you're trying to solve

The array append operation can be performed consecutively,Make code cleaner。

	for _, ts := range job.Spec.Tasks {
		// TODO(k82cn): The splitter and the prefix of env should be configurable.
		formateENVKey := strings.Replace(ts.Name, "-", "_", -1)
		envNames = append(envNames, fmt.Sprintf(EnvTaskHostFmt, strings.ToUpper(formateENVKey)))
		envNames = append(envNames, fmt.Sprintf(EnvHostNumFmt, strings.ToUpper(formateENVKey)))
	}

Describe the solution you'd like

It should be so

	for _, ts := range job.Spec.Tasks {
		// TODO(k82cn): The splitter and the prefix of env should be configurable.
		formateENVKey := strings.Replace(ts.Name, "-", "_", -1)
		envNames = append(envNames, fmt.Sprintf(EnvTaskHostFmt, strings.ToUpper(formateENVKey)),fmt.Sprintf(EnvHostNumFmt, strings.ToUpper(formateENVKey)))
	}

Additional context

No response

@feyounger feyounger added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 3, 2025
@feyounger
Copy link
Author

/assign

feyounger added a commit to feyounger/volcano that referenced this issue Mar 3, 2025
The array append operation can be performed consecutively,Make code cleaner

Fixes volcano-sh#4054
feyounger added a commit to feyounger/volcano that referenced this issue Mar 3, 2025
he array append operation can be performed consecutively,Make code cleaner

Fixes volcano-sh#4054

Signed-off-by: feyounger <1477865250@qq.com>
@feyounger feyounger linked a pull request Mar 3, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant