1// Copyright 2011 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Package user allows user account lookups by name or id. 6package user 7 8import ( 9 "strconv" 10) 11 12var implemented = true // set to false by lookup_stubs.go's init 13 14// User represents a user account. 15// 16// On posix systems Uid and Gid contain a decimal number 17// representing uid and gid. On windows Uid and Gid 18// contain security identifier (SID) in a string format. 19// On Plan 9, Uid, Gid, Username, and Name will be the 20// contents of /dev/user. 21type User struct { 22 Uid string // user id 23 Gid string // primary group id 24 Username string 25 Name string 26 HomeDir string 27} 28 29// UnknownUserIdError is returned by LookupId when 30// a user cannot be found. 31type UnknownUserIdError int 32 33func (e UnknownUserIdError) Error() string { 34 return "user: unknown userid " + strconv.Itoa(int(e)) 35} 36 37// UnknownUserError is returned by Lookup when 38// a user cannot be found. 39type UnknownUserError string 40 41func (e UnknownUserError) Error() string { 42 return "user: unknown user " + string(e) 43} 44