package main import ( "os" "path/filepath" "testing" . "github.com/smartystreets/goconvey/convey" ) func Test_mkdir(t *testing.T) { Convey("Test os.MkdirAll", t, func() { path := filepath.Join(os.TempDir(), "abc") defer os.RemoveAll(path) Convey("first create a directory", func() { err := os.MkdirAll(path, 0o755) So(err, ShouldBeNil) }) Convey("create a directory again", func() { err := os.MkdirAll(path, 0o755) So(err, ShouldBeNil) }) }) }