vendor
This commit is contained in:
25
vendor/github.com/lib/pq/internal/pqutil/user_posix.go
generated
vendored
Normal file
25
vendor/github.com/lib/pq/internal/pqutil/user_posix.go
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
//go:build !windows && !js && !android && !hurd && !zos && !wasip1 && !appengine
|
||||
|
||||
package pqutil
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/user"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func User() (string, error) {
|
||||
env := "USER"
|
||||
if runtime.GOOS == "plan9" {
|
||||
env = "user"
|
||||
}
|
||||
if n := os.Getenv(env); n != "" {
|
||||
return n, nil
|
||||
}
|
||||
|
||||
u, err := user.Current()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return u.Username, nil
|
||||
}
|
||||
Reference in New Issue
Block a user