woodpecker/vendor/github.com/lib/pq/user_posix.go
6543 b6e47a3f4a
Update deps (#724)
* update github.com/containerd/containerd v1.5.7 -> v1.5.9

* update github.com/lib/pq v1.10.3 -> v1.10.4

* update github.com/prometheus/client_golang v1.11.0 -> v1.12.0

* update github.com/rs/zerolog v1.25.0 -> v1.26.1

* update golang.org/x/crypto 2021-12-15 -> 2022-01-28
2022-01-29 16:04:50 +01:00

26 lines
579 B
Go

// Package pq is a pure Go Postgres driver for the database/sql package.
//go:build aix || darwin || dragonfly || freebsd || (linux && !android) || nacl || netbsd || openbsd || plan9 || solaris || rumprun || illumos
// +build aix darwin dragonfly freebsd linux,!android nacl netbsd openbsd plan9 solaris rumprun illumos
package pq
import (
"os"
"os/user"
)
func userCurrent() (string, error) {
u, err := user.Current()
if err == nil {
return u.Username, nil
}
name := os.Getenv("USER")
if name != "" {
return name, nil
}
return "", ErrCouldNotDetectUsername
}