source: code/trunk/vendor/github.com/lib/pq/user_posix.go@ 823

Last change on this file since 823 was 822, checked in by yakumo.izuru, 22 months ago

Prefer immortal.run over runit and rc.d, use vendored modules
for convenience.

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

File size: 579 bytes
Line 
1// Package pq is a pure Go Postgres driver for the database/sql package.
2
3//go:build aix || darwin || dragonfly || freebsd || (linux && !android) || nacl || netbsd || openbsd || plan9 || solaris || rumprun || illumos
4// +build aix darwin dragonfly freebsd linux,!android nacl netbsd openbsd plan9 solaris rumprun illumos
5
6package pq
7
8import (
9 "os"
10 "os/user"
11)
12
13func userCurrent() (string, error) {
14 u, err := user.Current()
15 if err == nil {
16 return u.Username, nil
17 }
18
19 name := os.Getenv("USER")
20 if name != "" {
21 return name, nil
22 }
23
24 return "", ErrCouldNotDetectUsername
25}
Note: See TracBrowser for help on using the repository browser.