本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
409B

  1. // Package pq is a pure Go Postgres driver for the database/sql package.
  2. // +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris rumprun
  3. package pq
  4. import (
  5. "os"
  6. "os/user"
  7. )
  8. func userCurrent() (string, error) {
  9. u, err := user.Current()
  10. if err == nil {
  11. return u.Username, nil
  12. }
  13. name := os.Getenv("USER")
  14. if name != "" {
  15. return name, nil
  16. }
  17. return "", ErrCouldNotDetectUsername
  18. }
上海开阖软件有限公司 沪ICP备12045867号-1