1
0

refactor: use fs/ helper to get temp dir

This commit is contained in:
dump_stack() 2023-05-13 12:33:12 +00:00
parent 4e77cf82d3
commit c8d171da98
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC

7
cache/cache.go vendored
View File

@ -6,7 +6,6 @@ package cache
import ( import (
"fmt" "fmt"
"io/ioutil"
"net/url" "net/url"
"os" "os"
"os/exec" "os/exec"
@ -15,7 +14,7 @@ import (
"github.com/cavaliergopher/grab/v3" "github.com/cavaliergopher/grab/v3"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"code.dumpstack.io/tools/out-of-tree/config" "code.dumpstack.io/tools/out-of-tree/fs"
) )
var URL = "https://out-of-tree.fra1.digitaloceanspaces.com/1.0.0/" var URL = "https://out-of-tree.fra1.digitaloceanspaces.com/1.0.0/"
@ -39,7 +38,7 @@ func unpackTar(archive, destination string) (err error) {
} }
func DownloadQemuImage(path, file string) (err error) { func DownloadQemuImage(path, file string) (err error) {
tmp, err := ioutil.TempDir(config.Dir("tmp"), "out-of-tree_") tmp, err := fs.TempDir()
if err != nil { if err != nil {
return return
} }
@ -65,7 +64,7 @@ func DownloadQemuImage(path, file string) (err error) {
} }
func DownloadDebianCache(cachePath string) (err error) { func DownloadDebianCache(cachePath string) (err error) {
tmp, err := ioutil.TempDir(config.Dir("tmp"), "out-of-tree_") tmp, err := fs.TempDir()
if err != nil { if err != nil {
return return
} }