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

Get file owners (uid/gid) #14753

Closed
W944 opened this issue Mar 10, 2016 · 9 comments
Closed

Get file owners (uid/gid) #14753

W944 opened this issue Mar 10, 2016 · 9 comments

Comments

@W944
Copy link

W944 commented Mar 10, 2016

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

-bash-4.1# go version
go version go1.5.1 linux/amd64

  1. What operating system and processor architecture are you using (go env)?

-bash-4.1# go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/lib/golang"
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT=""
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

  1. What did you do?

I can not find a way to read the owner uid/gid of a file.
Looking a the OS functions, I see chmod and chown, but there is no corresponding functions to actually see the current values.
https://golang.org/pkg/os/

  1. What did you expect to see?

A way to read the uid/gid owener of a file.

  1. What did you see instead?

Such a function is not present.

@bradfitz
Copy link
Contributor

Let's move this to https://golang.org/wiki/Questions

@techtonik
Copy link

So where is the answer there? (I don't see any search for wiki)

@bradfitz
Copy link
Contributor

bradfitz commented Oct 1, 2016

The page explains where to ask questions. It doesn't contain the answer to your question itself.

The answer is os.Stat's FileInfo.Sys.

@techtonik
Copy link

os.File.Stat FileInfo.Sys and it is not cross-platform.

@minux
Copy link
Member

minux commented Oct 1, 2016 via email

@techtonik
Copy link

Not portable even between two remote Linux systems. Or if filesystem doesn't support them. What is the return value of gid, uid if filesystem doesn't support them? Documentation doesn't mention that (or hides it too deep).

@minux
Copy link
Member

minux commented Oct 1, 2016 via email

@techtonik
Copy link

How to detect what kind of uid/gid is used by the system (and filesystem FWIW)?

@minux
Copy link
Member

minux commented Oct 1, 2016 via email

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

No branches or pull requests

4 participants