Source file src/cmd/go/internal/modfetch/cache_test.go
1 // Copyright 2018 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package modfetch 6 7 import ( 8 "context" 9 "os" 10 "path/filepath" 11 "testing" 12 ) 13 14 func TestWriteDiskCache(t *testing.T) { 15 ctx := context.Background() 16 17 tmpdir, err := os.MkdirTemp("", "go-writeCache-test-") 18 if err != nil { 19 t.Fatal(err) 20 } 21 defer os.RemoveAll(tmpdir) 22 23 err = writeDiskCache(ctx, filepath.Join(tmpdir, "file"), []byte("data")) 24 if err != nil { 25 t.Fatal(err) 26 } 27 } 28