Skip to content

Commit

Permalink
cmd/dist: list only supported platforms
Browse files Browse the repository at this point in the history
Introduce an incomplete map in dist alongside cgoEnabled and filter out
the incomplete ports in 'dist list'.

Fixes #28944

Change-Id: I15aae56aec570e1cd9e28906900cd5ba0db77811
Reviewed-on: https://go-review.googlesource.com/c/155839
Run-TryBot: Tobias Klauser <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
  • Loading branch information
tklauser committed Jan 2, 2019
1 parent 2e217fa commit 5ec5c57
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/cmd/dist/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,13 @@ var cgoEnabled = map[string]bool{
"windows/arm": false,
}

// List of platforms which are supported but not complete yet. These get
// filtered out of cgoEnabled for 'dist list'. See golang.org/issue/28944
var incomplete = map[string]bool{
"linux/riscv64": true,
"linux/sparc64": true,
}

func needCC() bool {
switch os.Getenv("CGO_ENABLED") {
case "1":
Expand Down Expand Up @@ -1576,6 +1583,9 @@ func cmdlist() {

var plats []string
for p := range cgoEnabled {
if incomplete[p] {
continue
}
plats = append(plats, p)
}
sort.Strings(plats)
Expand Down
3 changes: 3 additions & 0 deletions src/cmd/dist/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ func (t *tester) run() {
if t.failed {
fmt.Println("\nFAILED")
os.Exit(1)
} else if incomplete[goos+"/"+goarch] {
fmt.Println("\nFAILED (incomplete port)")
os.Exit(1)
} else if t.partial {
fmt.Println("\nALL TESTS PASSED (some were excluded)")
} else {
Expand Down

0 comments on commit 5ec5c57

Please sign in to comment.