Source File
lookup.go
Belonging Package
os/user
// Copyright 2011 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package userimport// Current returns the current user.//// The first call will cache the current user information.// Subsequent calls will return the cached value and will not reflect// changes to the current user.func () (*User, error) {cache.Do(func() { cache.u, cache.err = current() })if cache.err != nil {return nil, cache.err}:= *cache.u // copyreturn &, nil}// cache of the current uservar cache struct {sync.Onceu *Usererr error}// Lookup looks up a user by username. If the user cannot be found, the// returned error is of type UnknownUserError.func ( string) (*User, error) {if , := Current(); == nil && .Username == {return ,}return lookupUser()}// LookupId looks up a user by userid. If the user cannot be found, the// returned error is of type UnknownUserIdError.func ( string) (*User, error) {if , := Current(); == nil && .Uid == {return ,}return lookupUserId()}// LookupGroup looks up a group by name. If the group cannot be found, the// returned error is of type UnknownGroupError.func ( string) (*Group, error) {return lookupGroup()}// LookupGroupId looks up a group by groupid. If the group cannot be found, the// returned error is of type UnknownGroupIdError.func ( string) (*Group, error) {return lookupGroupId()}// GroupIds returns the list of group IDs that the user is a member of.func ( *User) () ([]string, error) {return listGroups()}
The pages are generated with Golds v0.2.8-preview. (GOOS=darwin GOARCH=arm64)