refactor: hrp convert

This commit is contained in:
buyuxiang
2022-05-24 13:36:34 +08:00
parent f19492c3f0
commit d0b2568797
37 changed files with 2245 additions and 626 deletions
+8 -1
View File
@@ -285,7 +285,8 @@ func LoadFile(path string, structObj interface{}) (err error) {
if err != nil {
return errors.Wrap(err, "read file failed")
}
// remove BOM at the beginning of file
file = bytes.Trim(file, "\xef\xbb\xbf")
ext := filepath.Ext(path)
switch ext {
case ".json", ".har":
@@ -351,3 +352,9 @@ func readFile(path string) ([]byte, error) {
}
return file, nil
}
func GetOutputNameWithoutExtension(path string) string {
base := filepath.Base(path)
ext := filepath.Ext(base)
return base[0:len(base)-len(ext)] + "_test"
}