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

Invalid application of virus arithmetic.New() #17

Open
Bios-Marcel opened this issue Jul 21, 2023 · 1 comment
Open

Invalid application of virus arithmetic.New() #17

Bios-Marcel opened this issue Jul 21, 2023 · 1 comment

Comments

@Bios-Marcel
Copy link
Contributor

Output shows, that the virus arithmetic.New() has been applied to a string concatenation, which causes a build failure.

internal/service/routing.go:168:9: invalid operation: operator - not defined on "/" (constant of type string)

This was the code:

func HealthPath() string {
	return "/" + path.Join(BasePathInternalCases(), "health")
}

I am assuming this is not intended behaviour.

@gtramontina
Copy link
Owner

Good catch! Indeed… not the intended behavior.

gtramontina pushed a commit that referenced this issue Aug 17, 2023
…terals anymore (#18)

arithmetic virus isn't applied to strings anymore

Note that this is only a partial fix (#17),
as it only works if the binary expression involves a string literal. Two string variables
will still cause an unwanted mutation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants