Add MustTempDir (#1069)

This commit is contained in:
anqiansong
2021-09-21 10:13:43 +08:00
committed by GitHub
parent 30e49f2939
commit 9a724fe907
11 changed files with 48 additions and 25 deletions

View File

@@ -6,7 +6,9 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/tal-tech/go-zero/tools/goctl/config"
"github.com/tal-tech/go-zero/tools/goctl/util"
)
var testTypes = `
@@ -18,7 +20,7 @@ func TestDo(t *testing.T) {
cfg, err := config.NewConfig(config.DefaultFormat)
assert.Nil(t, err)
tempDir := t.TempDir()
tempDir := util.MustTempDir()
typesfile := filepath.Join(tempDir, "types.go")
err = ioutil.WriteFile(typesfile, []byte(testTypes), 0o666)
assert.Nil(t, err)