1
0
mirror of https://github.com/golang/go synced 2024-11-11 23:50:22 -07:00

cmd/api: always do API check if hg is available

Fixes #6124

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/13500046
This commit is contained in:
Brad Fitzpatrick 2013-09-22 08:01:17 +01:00
parent f70116102b
commit afda774e95

View File

@ -21,7 +21,6 @@ import (
"os/exec" "os/exec"
"os/user" "os/user"
"path/filepath" "path/filepath"
"strconv"
"strings" "strings"
) )
@ -38,9 +37,9 @@ func main() {
if goroot == "" { if goroot == "" {
log.Fatal("No $GOROOT set.") log.Fatal("No $GOROOT set.")
} }
isGoDeveloper := exec.Command("hg", "pq").Run() == nil _, err := exec.LookPath("hg")
if !isGoDeveloper && !forceAPICheck() { if err != nil {
fmt.Println("Skipping cmd/api checks; hg codereview extension not available and GO_FORCE_API_CHECK not set") fmt.Println("Skipping cmd/api checks; hg not available")
return return
} }
@ -88,12 +87,6 @@ func file(s ...string) string {
return filepath.Join(goroot, "api", s[0]+".txt") return filepath.Join(goroot, "api", s[0]+".txt")
} }
// GO_FORCE_API_CHECK is set by builders.
func forceAPICheck() bool {
v, _ := strconv.ParseBool(os.Getenv("GO_FORCE_API_CHECK"))
return v
}
// prepGoPath returns a GOPATH for the "go" tool to compile the API tool with. // prepGoPath returns a GOPATH for the "go" tool to compile the API tool with.
// It tries to re-use a go.tools checkout from a previous run if possible, // It tries to re-use a go.tools checkout from a previous run if possible,
// else it hg clones it. // else it hg clones it.