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

use "path/filepath" to build file path #1767

Merged
merged 1 commit into from
Mar 26, 2024
Merged

Conversation

seiyab
Copy link
Contributor

@seiyab seiyab commented Mar 24, 2024

I found path.Dir() which looks misuse.

package "path" suggests:

The path package should only be used for paths separated by forward slashes, such as the paths in URLs. This package does not deal with Windows paths with drive letters or backslashes; to manipulate operating system paths, use the path/filepath package.

NOTE: I found this just scanning project statically. I haven't reproduced "real" problem. Even I don't have Windows environment.

This line looks to be covered by existing test.

case *scanResultStreamWriter:
assert.Equal(t, string(w.format), e.format)
assert.NotNil(t, w.out)
if e.file != "" {
assert.FileExists(t, tmp+e.file)
}

Signed-off-by: seiya <20365512+seiyab@users.noreply.github.com>
Copy link
Contributor

@kzantow kzantow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @seiyab! You're right, this function could be OS dependent and looks to be already covered by tests, at least on linux. 👍

@kzantow kzantow merged commit c4c6a40 into anchore:main Mar 26, 2024
10 checks passed
@seiyab seiyab deleted the use-filepath branch March 26, 2024 21:24
@spiffcs spiffcs added the bug Something isn't working label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants