// Copyright 2024 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package cryptotestimport ()// FetchModule fetches the module at the given version and returns the directory// containing its source tree. It skips the test if fetching modules is not// possible in this environment.func ( *testing.T, , string) string {testenv.MustHaveExternalNetwork() := testenv.GoToolPath()// If the default GOMODCACHE doesn't exist, use a temporary directory // instead. (For example, run.bash sets GOPATH=/nonexist-gopath.) , := testenv.Command(, , "env", "GOMODCACHE").Output()if != nil { .Fatalf("%s env GOMODCACHE: %v\n%s", , , ) } := falseif := string(bytes.TrimSpace()); != "" {if , := os.Stat(); == nil { = true } }if ! { .Setenv("GOMODCACHE", .TempDir())// Allow t.TempDir() to clean up subdirectories. .Setenv("GOFLAGS", os.Getenv("GOFLAGS")+" -modcacherw") } .Logf("fetching %s@%s\n", , ) , := testenv.Command(, , "mod", "download", "-json", +"@"+).CombinedOutput()if != nil { .Fatalf("failed to download %s@%s: %s\n%s\n", , , , ) }varstruct {string }if := json.Unmarshal(, &); != nil { .Fatalf("failed to parse 'go mod download': %s\n%s\n", , ) }return .}
The pages are generated with Goldsv0.7.3. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.