os/user: add bare-bones implementation of the os/user package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Этот коммит содержится в:
родитель
1d9c53d00e
коммит
cfc32794a7
2 изменённых файлов: 42 добавлений и 0 удалений
|
@ -244,6 +244,7 @@ func pathsToOverride(goMinor int, needsSyscallPackage bool) map[string]bool {
|
||||||
"net/": true,
|
"net/": true,
|
||||||
"net/http/": false,
|
"net/http/": false,
|
||||||
"os/": true,
|
"os/": true,
|
||||||
|
"os/user/": false,
|
||||||
"reflect/": false,
|
"reflect/": false,
|
||||||
"runtime/": false,
|
"runtime/": false,
|
||||||
"sync/": true,
|
"sync/": true,
|
||||||
|
|
41
src/os/user/user.go
Обычный файл
41
src/os/user/user.go
Обычный файл
|
@ -0,0 +1,41 @@
|
||||||
|
// Copyright 2016 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 user
|
||||||
|
|
||||||
|
import "errors"
|
||||||
|
|
||||||
|
// User represents a user account.
|
||||||
|
type User struct {
|
||||||
|
// Uid is the user ID.
|
||||||
|
// On POSIX systems, this is a decimal number representing the uid.
|
||||||
|
// On Windows, this is a security identifier (SID) in a string format.
|
||||||
|
// On Plan 9, this is the contents of /dev/user.
|
||||||
|
Uid string
|
||||||
|
// Gid is the primary group ID.
|
||||||
|
// On POSIX systems, this is a decimal number representing the gid.
|
||||||
|
// On Windows, this is a SID in a string format.
|
||||||
|
// On Plan 9, this is the contents of /dev/user.
|
||||||
|
Gid string
|
||||||
|
// Username is the login name.
|
||||||
|
Username string
|
||||||
|
// Name is the user's real or display name.
|
||||||
|
// It might be blank.
|
||||||
|
// On POSIX systems, this is the first (or only) entry in the GECOS field
|
||||||
|
// list.
|
||||||
|
// On Windows, this is the user's display name.
|
||||||
|
// On Plan 9, this is the contents of /dev/user.
|
||||||
|
Name string
|
||||||
|
// HomeDir is the path to the user's home directory (if they have one).
|
||||||
|
HomeDir string
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 Current() (*User, error) {
|
||||||
|
return nil, errors.New("user: Current not implemented")
|
||||||
|
}
|
Загрузка…
Создание таблицы
Сослаться в новой задаче