1
0
mirror of https://github.com/golang/go synced 2024-11-12 05:40:22 -07:00

cmd/api: don't fail API check if there's no network

If the hg checkout of go.tools fails, check for Internet
connectivity before failing.

R=golang-dev, shivakumar.gn
CC=golang-dev
https://golang.org/cl/12814043
This commit is contained in:
Brad Fitzpatrick 2013-08-12 19:18:47 -07:00
parent 4984e6e9fd
commit 4d2494330e

View File

@ -16,6 +16,7 @@ package main
import ( import (
"fmt" "fmt"
"log" "log"
"net/http"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
@ -109,6 +110,10 @@ func prepGoPath() string {
cmd.Dir = cloneDir cmd.Dir = cloneDir
out, err := cmd.CombinedOutput() out, err := cmd.CombinedOutput()
if err != nil { if err != nil {
if _, err := http.Head("http://ip.appspot.com/"); err != nil {
log.Printf("# Skipping API check; network appears to be unavailable")
os.Exit(0)
}
log.Fatalf("Error running hg clone on go.tools: %v\n%s", err, out) log.Fatalf("Error running hg clone on go.tools: %v\n%s", err, out)
} }
if err := os.Rename(tmpDir, finalDir); err != nil { if err := os.Rename(tmpDir, finalDir); err != nil {