Skip to content

cgo_lookup_unix #25973

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

Closed
denisvolin opened this issue Jun 20, 2018 · 1 comment
Closed

cgo_lookup_unix #25973

denisvolin opened this issue Jun 20, 2018 · 1 comment

Comments

@denisvolin
Copy link

denisvolin commented Jun 20, 2018

Please answer these questions before submitting your issue. Thanks!

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

go1.10 linux/amd64

Does this issue reproduce with the latest release?

Not sure, though source code still has the issue.

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

linux, amd64

What did you do?

Called user.Lookup from os/user with "speech-dispatcher". Why? It was attempt to manually parse some unrelated file.

You just need to call user.Lookup on a linux with cgo support, so that cgo_lookup_unix.go file will be used.
For some unknown reason, the whole call ends up at line 78, where buildUser is called and error is nil.

package main

import "os/user"

func main() {
    u, err := user.Lookup("speech-dispatcher")
    if err == nil && u.Username == "speech-dispatcher" { panic("oh, boy!") }
}

What did you expect to see?

UnknownUserError

What did you see instead?

nil

@denisvolin
Copy link
Author

denisvolin commented Jun 20, 2018

I'm an idiot! Sorry. Just figured out the issue myself. It's not you. It's me. Sorry.

@golang golang locked and limited conversation to collaborators Jun 20, 2019
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

2 participants