go.crypto/ssh/test: improve diagnostics for test failing to get username.
R=golang-dev, dave CC=golang-dev https://golang.org/cl/8817043
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@@ -79,6 +80,7 @@ func username() string {
|
|||||||
} else {
|
} else {
|
||||||
// user.Current() currently requires cgo. If an error is
|
// user.Current() currently requires cgo. If an error is
|
||||||
// returned attempt to get the username from the environment.
|
// returned attempt to get the username from the environment.
|
||||||
|
log.Printf("user.Current: %v; falling back on $USER", err)
|
||||||
username = os.Getenv("USER")
|
username = os.Getenv("USER")
|
||||||
}
|
}
|
||||||
if username == "" {
|
if username == "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user