Repository: go
Issue: cmd/api: test particularly slow in wsl2
Labels: ToolSpeed,NeedsInvestigation

### Go version

go version devel go1.23-628b1015b97 Mon Feb 12 07:15:06 2024 +0000 linux/amd64

### Output of `go env` in your module/workspace:

```shell
GO111MODULE='auto'
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/qiulaidongfeng/.cache/go-build'
GOENV='/home/qiulaidongfeng/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/qiulaidongfeng/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/qiulaidongfeng/go'
GOPRIVATE=''
GOPROXY='https://goproxy.cn,direct'
GOROOT='/mnt/d/file/gofile/gogit/go1'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/mnt/d/file/gofile/gogit/go1/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.23-628b1015b97 Mon Feb 12 07:15:06 2024 +0000'
GCCGO='gccgo'
GOAMD64='v3'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/mnt/d/file/gofile/gogit/go1/src/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3296680104=/tmp/go-build -gno-record-gcc-switches'
```


### What did you do?

in wsl2

./all.bash

### What did you see happen?

The test time is not too slow compared to windows.

### What did you expect to see?

ok      cmd/api 971.468s

##### API check
ok      cmd/api 763.277s

in
```
./all.bash
Building Go cmd/dist using /usr/lib/go-1.21. (go1.21.6 linux/amd64)
Building Go toolchain1 using /usr/lib/go-1.21.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.

##### Test execution environment.
# GOARCH: amd64
# CPU: AMD Ryzen 7 7840HS w/ Radeon 780M Graphics
# GOOS: linux
# OS Version: Linux 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64

##### Testing packages.
ok      archive/tar     0.359s
ok      archive/zip     0.381s
ok      bufio   0.043s
ok      bytes   0.095s
ok      cmp     0.007s
ok      compress/bzip2  0.071s
ok      compress/flate  0.437s
ok      compress/gzip   0.620s
ok      compress/lzw    0.016s
ok      compress/zlib   0.047s
ok      container/heap  0.005s
ok      container/list  0.004s
ok      container/ring  0.003s
ok      context 0.023s
ok      crypto  0.002s
ok      crypto/aes      0.014s
ok      crypto/cipher   0.009s
ok      crypto/des      0.009s
ok      crypto/dsa      0.006s
ok      crypto/ecdh     0.033s
ok      crypto/ecdsa    0.022s
ok      crypto/ed25519  0.057s
ok      crypto/elliptic 0.009s
ok      crypto/hmac     0.009s
ok      crypto/internal/alias   0.017s
ok      crypto/internal/bigmod  0.044s
ok      crypto/internal/boring  0.005s
ok      crypto/internal/boring/bcache   0.047s
ok      crypto/internal/edwards25519    0.050s
ok      crypto/internal/edwards25519/field      0.022s
ok      crypto/internal/nistec  0.150s
ok      crypto/internal/nistec/fiat     0.005s [no tests to run]
ok      crypto/md5      0.033s
ok      crypto/rand     0.049s
ok      crypto/rc4      0.022s
ok      crypto/rsa      0.217s
ok      crypto/sha1     0.042s
ok      crypto/sha256   0.003s
ok      crypto/sha512   0.031s
ok      crypto/subtle   0.048s
ok      crypto/tls      0.934s
ok      crypto/x509     0.233s
ok      database/sql    0.480s
ok      database/sql/driver     0.007s
ok      debug/buildinfo 0.009s
ok      debug/dwarf     1.348s
ok      debug/elf       0.429s
ok      debug/gosym     5.606s
ok      debug/macho     0.141s
ok      debug/pe        1.211s
ok      debug/plan9obj  0.015s
ok      embed   0.006s [no tests to run]
ok      embed/internal/embedtest        0.012s
ok      encoding/ascii85        0.007s
ok      encoding/asn1   0.007s
ok      encoding/base32 0.013s
ok      encoding/base64 0.020s
ok      encoding/binary 0.010s
ok      encoding/csv    0.010s
ok      encoding/gob    1.107s
ok      encoding/hex    0.010s
ok      encoding/json   0.188s
ok      encoding/pem    0.417s
ok      encoding/xml    0.116s
ok      errors  0.034s
ok      expvar  0.027s
ok      flag    0.077s
ok      fmt     0.041s
ok      go/ast  0.008s
ok      go/build        17.022s
ok      go/build/constraint     0.016s
ok      go/constant     0.012s
ok      go/doc  1.084s
ok      go/doc/comment  47.034s
ok      go/format       0.020s
ok      go/importer     8.535s
ok      go/internal/gccgoimporter       0.360s
ok      go/internal/gcimporter  52.504s
ok      go/internal/srcimporter 112.183s
ok      go/parser       0.501s
ok      go/printer      0.115s
ok      go/scanner      0.007s
ok      go/token        0.011s
ok      go/types        335.395s
ok      go/version      0.005s
ok      hash    0.004s
ok      hash/adler32    0.008s
ok      hash/crc32      0.008s
ok      hash/crc64      0.006s
ok      hash/fnv        0.006s
ok      hash/maphash    0.042s
ok      html    0.003s
ok      html/template   0.120s
ok      image   0.140s
ok      image/color     0.014s
ok      image/draw      0.056s
ok      image/gif       0.130s
ok      image/jpeg      0.230s
ok      image/png       0.361s
ok      index/suffixarray       0.093s
ok      internal/abi    1.620s
ok      internal/buildcfg       0.004s
ok      internal/chacha8rand    0.006s
ok      internal/coverage/cformat       0.024s
ok      internal/coverage/cmerge        0.007s
ok      internal/coverage/pods  0.007s
ok      internal/coverage/slicereader   0.006s
ok      internal/coverage/slicewriter   0.005s
ok      internal/coverage/test  0.009s
ok      internal/cpu    0.008s
ok      internal/dag    0.006s
ok      internal/diff   0.097s
ok      internal/fmtsort        0.005s
ok      internal/fuzz   0.011s
ok      internal/godebug        4.341s
ok      internal/godebugs       0.014s
ok      internal/gover  0.006s
ok      internal/intern 0.089s
ok      internal/itoa   0.006s
ok      internal/platform       4.020s
ok      internal/poll   0.178s
ok      internal/profile        0.010s
ok      internal/reflectlite    0.010s
ok      internal/safefilepath   0.009s
ok      internal/saferio        0.019s
ok      internal/singleflight   0.021s
ok      internal/testenv        4.780s
ok      internal/trace  0.343s
ok      internal/trace/v2       51.291s
ok      internal/types/errors   12.088s
ok      internal/unsafeheader   0.009s
ok      internal/xcoff  1.278s
ok      internal/zstd   0.391s
ok      io      0.027s
ok      io/fs   0.188s
ok      io/ioutil       0.039s
ok      log     0.003s
ok      log/slog        0.023s
ok      log/slog/internal/benchmarks    0.015s
ok      log/slog/internal/buffer        0.014s
ok      log/syslog      1.224s
ok      maps    0.024s
ok      math    0.009s
ok      math/big        0.495s
ok      math/bits       0.006s
ok      math/cmplx      0.005s
ok      math/rand       0.059s
ok      math/rand/v2    0.132s
ok      mime    0.066s
ok      mime/multipart  0.358s
ok      mime/quotedprintable    0.040s
ok      net     2.992s
ok      net/http        10.325s
ok      net/http/cgi    0.075s
ok      net/http/cookiejar      0.008s
ok      net/http/fcgi   0.207s
ok      net/http/httptest       0.023s
ok      net/http/httptrace      0.005s
ok      net/http/httputil       0.552s
ok      net/http/internal       0.094s
ok      net/http/internal/ascii 0.005s
ok      net/http/pprof  5.059s
ok      net/internal/cgotest    0.005s
ok      net/internal/socktest   0.006s
ok      net/mail        0.007s
ok      net/netip       4.169s
ok      net/rpc 0.026s
ok      net/rpc/jsonrpc 0.012s
ok      net/smtp        0.023s
ok      net/textproto   0.037s
ok      net/url 0.011s
ok      os      5.989s
ok      os/exec 1.049s
ok      os/exec/internal/fdtest 0.010s
ok      os/signal       5.249s
ok      os/user 0.008s
ok      path    0.004s
ok      path/filepath   0.418s
ok      plugin  0.009s
ok      reflect 0.185s
ok      regexp  0.320s
ok      regexp/syntax   0.488s
ok      runtime 183.389s
ok      runtime/cgo     0.006s
ok      runtime/coverage        0.006s
ok      runtime/debug   0.077s
ok      runtime/internal/atomic 0.027s
ok      runtime/internal/math   0.015s
ok      runtime/internal/sys    0.005s
ok      runtime/internal/syscall        0.006s
ok      runtime/internal/wasitest       0.006s
ok      runtime/metrics 0.014s
ok      runtime/pprof   16.108s
ok      runtime/trace   0.254s
ok      slices  0.065s
ok      sort    0.049s
ok      strconv 0.245s
ok      strings 0.071s
ok      sync    0.307s
ok      sync/atomic     0.674s
ok      syscall 9.768s
ok      testing 0.604s
ok      testing/fstest  0.008s
ok      testing/iotest  0.006s
ok      testing/quick   0.023s
ok      testing/slogtest        0.007s
ok      text/scanner    0.009s
ok      text/tabwriter  0.008s
ok      text/template   0.104s
ok      text/template/parse     0.010s
ok      time    1.624s
ok      unicode 0.005s
ok      unicode/utf16   0.005s
ok      unicode/utf8    0.007s
ok      cmd/addr2line   5.074s
ok      cmd/api 971.468s
ok      cmd/asm/internal/asm    3.578s
ok      cmd/asm/internal/lex    0.035s
ok      cmd/cgo/internal/swig   0.254s
ok      cmd/cgo/internal/test   0.743s
ok      cmd/cgo/internal/testcarchive   0.007s
ok      cmd/cgo/internal/testcshared    0.007s
ok      cmd/cgo/internal/testerrors     123.853s
ok      cmd/cgo/internal/testfortran    0.188s
ok      cmd/cgo/internal/testgodefs     8.052s
ok      cmd/cgo/internal/testlife       6.360s
ok      cmd/cgo/internal/testnocgo      0.006s
ok      cmd/cgo/internal/testplugin     0.007s
ok      cmd/cgo/internal/testsanitizers 124.615s
ok      cmd/cgo/internal/testshared     0.006s
ok      cmd/cgo/internal/testso 20.044s
ok      cmd/cgo/internal/teststdio      25.692s
ok      cmd/cgo/internal/testtls        0.008s
ok      cmd/compile/internal/abt        0.010s
ok      cmd/compile/internal/amd64      1.873s
ok      cmd/compile/internal/base       0.006s
ok      cmd/compile/internal/compare    0.007s
ok      cmd/compile/internal/devirtualize       0.008s
ok      cmd/compile/internal/dwarfgen   5.808s
ok      cmd/compile/internal/importer   113.393s
ok      cmd/compile/internal/inline/inlheur     19.208s
ok      cmd/compile/internal/ir 0.016s
ok      cmd/compile/internal/logopt     3.934s
ok      cmd/compile/internal/loopvar    373.680s
ok      cmd/compile/internal/noder      0.008s
ok      cmd/compile/internal/reflectdata        0.007s [no tests to run]
ok      cmd/compile/internal/ssa        212.648s
ok      cmd/compile/internal/syntax     1.021s
ok      cmd/compile/internal/test       83.925s
ok      cmd/compile/internal/typecheck  8.976s
ok      cmd/compile/internal/types      0.006s
ok      cmd/compile/internal/types2     375.294s
ok      cmd/covdata     0.108s
ok      cmd/cover       21.313s
ok      cmd/dist        0.007s
ok      cmd/distpack    0.007s
ok      cmd/doc 48.289s
ok      cmd/fix 2.779s
ok      cmd/go  404.929s
ok      cmd/go/internal/auth    0.014s
ok      cmd/go/internal/cache   0.153s
ok      cmd/go/internal/cfg     0.019s [no tests to run]
ok      cmd/go/internal/envcmd  0.100s
ok      cmd/go/internal/fsys    0.165s
ok      cmd/go/internal/generate        0.153s
ok      cmd/go/internal/gover   0.018s
ok      cmd/go/internal/imports 0.892s
ok      cmd/go/internal/load    0.011s
ok      cmd/go/internal/lockedfile      0.051s
ok      cmd/go/internal/lockedfile/internal/filelock    0.070s
ok      cmd/go/internal/modfetch        0.021s
ok      cmd/go/internal/modfetch/codehost       0.832s
ok      cmd/go/internal/modfetch/zip_sum_test   0.026s
ok      cmd/go/internal/modindex        37.210s
ok      cmd/go/internal/modload 0.011s
ok      cmd/go/internal/mvs     0.011s
ok      cmd/go/internal/par     0.030s
ok      cmd/go/internal/str     0.030s
ok      cmd/go/internal/test    1.286s
ok      cmd/go/internal/toolchain       0.115s
ok      cmd/go/internal/vcs     0.017s
ok      cmd/go/internal/vcweb   0.021s
ok      cmd/go/internal/vcweb/vcstest   2.022s
ok      cmd/go/internal/web     0.060s
ok      cmd/go/internal/work    0.298s
ok      cmd/gofmt       5.579s
ok      cmd/internal/archive    49.621s
ok      cmd/internal/bootstrap_test     0.013s
ok      cmd/internal/buildid    0.185s
ok      cmd/internal/cov        31.088s
ok      cmd/internal/dwarf      0.019s
ok      cmd/internal/edit       0.018s
ok      cmd/internal/goobj      0.040s
ok      cmd/internal/moddeps    360.735s
ok      cmd/internal/notsha256  0.014s
ok      cmd/internal/obj        20.070s
ok      cmd/internal/obj/ppc64  4.200s
ok      cmd/internal/obj/riscv  2.641s
ok      cmd/internal/obj/s390x  0.022s
ok      cmd/internal/obj/x86    16.308s
ok      cmd/internal/objabi     26.070s
ok      cmd/internal/pkgpath    0.031s
ok      cmd/internal/pkgpattern 0.017s
ok      cmd/internal/quoted     0.014s
ok      cmd/internal/src        0.017s
ok      cmd/internal/test2json  0.980s
ok      cmd/link        111.197s
ok      cmd/link/internal/benchmark     0.016s
ok      cmd/link/internal/ld    70.432s
ok      cmd/link/internal/loader        0.033s
ok      cmd/nm  34.282s
ok      cmd/objdump     77.020s
ok      cmd/pack        50.569s
ok      cmd/pprof       25.333s
ok      cmd/relnote     0.031s
ok      cmd/trace       0.030s
ok      cmd/trace/v2    0.266s
ok      cmd/vet 51.575s

##### os/user with tag osusergo
ok      os/user 0.006s

##### hash/maphash purego implementation
ok      hash/maphash    0.044s

##### GOMAXPROCS=2 runtime -cpu=1,2,4 -quick
ok      runtime 27.821s

##### GOEXPERIMENT=rangefunc go test iter
ok      iter    0.002s

##### Testing without libgcc.
ok      net     0.007s
ok      os/user 0.005s

##### internal linking of -buildmode=pie
ok      reflect 0.076s
ok      os/user 0.005s

##### sync -cpu=10
ok      sync    0.307s

##### Testing race detector
ok      runtime/race    36.983s
ok      flag    1.011s
ok      net     1.088s
ok      os      1.089s
ok      os/exec 2.024s
ok      encoding/gob    1.022s
ok      flag    1.010s
ok      os/exec 2.020s

##### Testing cgo
ok      cmd/cgo/internal/test   0.700s
ok      cmd/cgo/internal/test   0.697s
ok      cmd/cgo/internal/testtls        0.005s
ok      cmd/cgo/internal/testtls        0.011s
ok      cmd/cgo/internal/testnocgo      0.003s
ok      cmd/cgo/internal/testnocgo      0.003s
ok      cmd/cgo/internal/test   0.702s
ok      cmd/cgo/internal/test   0.712s
ok      cmd/cgo/internal/test   0.710s
ok      cmd/cgo/internal/test   0.718s
ok      cmd/cgo/internal/testtls        0.006s
ok      cmd/cgo/internal/testnocgo      0.005s

##### ../test
ok      cmd/internal/testdir    198.828s

##### API check
ok      cmd/api 763.277s

##### API release note check
ok      cmd/relnote     0.025s

ALL TESTS PASSED
---
Installed Go for linux/amd64 in /mnt/d/file/gofile/gogit/go1
Installed commands in /mnt/d/file/gofile/gogit/go1/bin
*** You need to add /mnt/d/file/gofile/gogit/go1/bin to your PATH.
```