]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/api: don't depend on os/user or USER to check api
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 5 Sep 2014 00:13:22 +0000 (17:13 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 5 Sep 2014 00:13:22 +0000 (17:13 -0700)
The -nocgo builder failed because it has cgo disabled
as well as no USER environment variable:
http://build.golang.org/log/2250abb82f5022b72a12997b8ff89fcdeff094c9

# Checking API compatibility.
Error getting current user: user: Current not implemented on linux/amd64
exit status 1

Don't require the environment variable here.

LGTM=minux
R=dave, adg, minux
CC=golang-codereviews
https://golang.org/cl/140290043

src/cmd/api/run.go

index 896b2b4a1a4e5af4a65c98c3064c7612e3dd36d6..c323deb6031540a3ff800f9038bb5078ac064a00 100644 (file)
@@ -98,11 +98,9 @@ func prepGoPath() string {
        if err == nil {
                username = u.Username
        } else {
-               // Only need to handle Unix here, as Windows's os/user uses
-               // native syscall and should work fine without cgo.
                username = os.Getenv("USER")
                if username == "" {
-                       log.Fatalf("Error getting current user: %v", err)
+                       username = "nobody"
                }
        }