dashboard: simplify 'go tool dist list' invocation

It's viable to use go tool subcommand now that CL 505176 landed.
It's included in the recent Go 1.21 Release Candidate 3 release.

For golang/go#60939.

Change-Id: I4d64e145eba5fb9761790f5445773aff08330a42
Reviewed-on: https://go-review.googlesource.com/c/build/+/505216
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
Dmitri Shuralyov 2023-06-22 13:52:02 -04:00 коммит произвёл Gopher Robot
Родитель c42ce50790
Коммит 20e1bba25b
1 изменённых файлов: 1 добавлений и 11 удалений

Просмотреть файл

@ -6,7 +6,6 @@ package dashboard
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"os"
@ -16,8 +15,6 @@ import (
"strings"
"testing"
"time"
"golang.org/x/build/internal/envutil"
)
func TestOSARCHAccessors(t *testing.T) {
@ -1406,14 +1403,7 @@ func TestWindowsCCSetup(t *testing.T) {
// listPorts lists supported Go ports
// found by running go tool dist list.
func listPorts() ([]string, error) {
var env struct{ GOROOT string }
if out, err := exec.Command("go", "env", "-json", "GOROOT").Output(); err != nil {
return nil, err
} else if err := json.Unmarshal(out, &env); err != nil {
return nil, err
}
cmd := exec.Command("go", "run", "cmd/dist", "list")
envutil.SetEnv(cmd, "GOROOT="+env.GOROOT)
cmd := exec.Command("go", "tool", "dist", "list")
out, err := cmd.Output()
if err != nil {
if ee := (*exec.ExitError)(nil); errors.As(err, &ee) {