• Joe Tsai's avatar
    archive/tar: populate uname/gname/devmajor/devminor in FileInfoHeader · 0564e304
    Joe Tsai authored
    We take a best-effort approach since information for these fields
    are not well supported on all platforms.
    
    user.LookupId+user.LookupGroupId is currently 15x slower than os.Stat.
    For performance reasons, we perpetually cache username and groupname
    with a sync.Map. As a result, this function will not be updated whenever
    the user or group names are renamed in the OS. However, this is a better
    situation than before, where those fields were not populated at all.
    
    Change-Id: I3cec8291aed7675dea89ee1cbda92bd493c8831f
    Reviewed-on: https://go-review.googlesource.com/59531
    Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    0564e304
stat_unix.go 1.9 KB