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. 19type User struct { 20 Uid string // user id 21 Gid string // primary group id 22 Username string 23 Name string 24 HomeDir string 25} 26 27// UnknownUserIdError is returned by LookupId when 28// a user cannot be found. 29type UnknownUserIdError int 30 31func (e UnknownUserIdError) Error() string { 32 return "user: unknown userid " + strconv.Itoa(int(e)) 33} 34 35// UnknownUserError is returned by Lookup when 36// a user cannot be found. 37type UnknownUserError string 38 39func (e UnknownUserError) Error() string { 40 return "user: unknown user " + string(e) 41} 42