src/pkg/os/user/user.go - The Go Programming Language

Golang

Source file src/pkg/os/user/user.go

     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.
     6	package user
     7	
     8	import (
     9		"strconv"
    10	)
    11	
    12	var 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	type 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.
    29	type UnknownUserIdError int
    30	
    31	func (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.
    37	type UnknownUserError string
    38	
    39	func (e UnknownUserError) Error() string {
    40		return "user: unknown user " + string(e)
    41	}