Skip to content

Commit

Permalink
ParseFirstComponent(): Remove unnecesary mutation of rp
Browse files Browse the repository at this point in the history
This method doesn't take a pointer receiver, so mutating rp.path is
pointless.
  • Loading branch information
EdSchouten committed Jun 21, 2024
1 parent a085352 commit 48cf1ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions pkg/filesystem/path/unix_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ func (rp unixRelativeParser) ParseFirstComponent(componentWalker ComponentWalker
remainder = nil
} else {
name = rp.path[:slash]
rp.path = stripUNIXSeparators(rp.path[slash:])
remainder = unixRelativeParser{rp.path}
remainder = unixRelativeParser{
path: stripUNIXSeparators(rp.path[slash:]),
}
}

switch name {
Expand Down
5 changes: 3 additions & 2 deletions pkg/filesystem/path/windows_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ func (rp windowsRelativeParser) ParseFirstComponent(componentWalker ComponentWal
remainder = nil
} else {
name = rp.path[:separator]
rp.path = stripWindowsSeparators(rp.path[separator:])
remainder = windowsRelativeParser{rp.path}
remainder = windowsRelativeParser{
path: stripWindowsSeparators(rp.path[separator:]),
}
}

switch name {
Expand Down

0 comments on commit 48cf1ee

Please sign in to comment.