Add MustTempDir (#1069)
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -180,3 +181,13 @@ func createTemplate(file, content string, force bool) error {
|
||||
_, err = f.WriteString(content)
|
||||
return err
|
||||
}
|
||||
|
||||
// MustTempDir creates a temporary directory
|
||||
func MustTempDir() string {
|
||||
dir, err := ioutil.TempDir("", "")
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
return dir
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ func (s String) Upper() string {
|
||||
|
||||
// ReplaceAll calls the strings.ReplaceAll
|
||||
func (s String) ReplaceAll(old, new string) string {
|
||||
return strings.ReplaceAll(s.source, old, new)
|
||||
return strings.Replace(s.source, old, new, -1)
|
||||
}
|
||||
|
||||
// Source returns the source string value
|
||||
|
||||
Reference in New Issue
Block a user