Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/user: User.Uid should be int instead of string #30308

Closed
AnikHasibul opened this issue Feb 19, 2019 · 2 comments
Closed

os/user: User.Uid should be int instead of string #30308

AnikHasibul opened this issue Feb 19, 2019 · 2 comments

Comments

@AnikHasibul
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.11 linux/amd64

Does this issue reproduce with the latest release?

Yes!

$ go doc user.User
package user // import "os/user"

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
}
    User represents a user account.

What did you expect to see?

$ go doc user.User
package user // import "os/user"

type User struct {
	Uid int
	Gid int
	Username string
	Name string
	HomeDir string
}

What did you see instead?

$ go doc user.User
package user // import "os/user"

type User struct {
	Uid string
	Gid string
	Username string
	Name string
	HomeDir string
}
@dominikh
Copy link
Member

The documentation for Uid points out that it is only numeric on POSIX systems. On other systems, they're string values. It therefore cannot be an integer.

@mikioh mikioh changed the title user.User.Uid should be int instead of string os/user: User.Uid should be int instead of string Feb 19, 2019
@ianlancetaylor
Copy link
Contributor

See also #6495.

@golang golang locked and limited conversation to collaborators Feb 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants