Skip to content

Commit

Permalink
tests/converter: fix invalid use of user.Username
Browse files Browse the repository at this point in the history
The Go package `user` has a `Current` function that returns the current
user. We should use `user.Current().Username` instead of
`user.Current().Name` to get the current username. This patch fixes it.

Signed-off-by: Yifan Zhao <[email protected]>
  • Loading branch information
SToPire committed Sep 26, 2024
1 parent bc11b08 commit ab1fe00
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func writeFileToTar(t *testing.T, tw *tar.Writer, name string, data string) {
Name: name,
Mode: 0444,
Size: int64(len(data)),
Uname: u.Name,
Uname: u.Username,
Gname: g.Name,
}
err = tw.WriteHeader(hdr)
Expand All @@ -158,7 +158,7 @@ func writeDirToTar(t *testing.T, tw *tar.Writer, name string) {
Name: name,
Mode: 0444,
Typeflag: tar.TypeDir,
Uname: u.Name,
Uname: u.Username,
Gname: g.Name,
}
err = tw.WriteHeader(hdr)
Expand Down

0 comments on commit ab1fe00

Please sign in to comment.