• Kevin Burke's avatar
    os/user: add non-cgo versions of Lookup, LookupId · c2eb0619
    Kevin Burke authored
    If you cross compile for a Unix target and call user.Lookup("root")
    or user.LookupId("0"), we'll try to read the answer out of
    /etc/passwd instead of returning an "unimplemented" error.
    
    The equivalent cgo function calls getpwuid_r in glibc, which
    may reach out to the NSS database or allow callers to register
    extensions. The pure Go implementation only reads from /etc/passwd.
    
    Change-Id: I56a302d634b15ba5097f9f0d6a758c68e486ba6d
    Reviewed-on: https://go-review.googlesource.com/37664Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    c2eb0619
lookup_unix_test.go 7.64 KB