TmpFolderName make public

This commit is contained in:
lyyyuna 2021-07-22 19:54:14 +08:00
parent 5f4f5c5bd7
commit 9aeb1da8f8
2 changed files with 4 additions and 4 deletions

View File

@ -43,11 +43,11 @@ func (b *Build) readProjectMetaInfo() {
} }
// get tmp folder name // get tmp folder name
config.GocConfig.TmpModProjectDir = filepath.Join(os.TempDir(), tmpFolderName(config.GocConfig.CurModProjectDir)) config.GocConfig.TmpModProjectDir = filepath.Join(os.TempDir(), TmpFolderName(config.GocConfig.CurModProjectDir))
// get working dir in the corresponding tmp dir // get working dir in the corresponding tmp dir
config.GocConfig.TmpWd = filepath.Join(config.GocConfig.TmpModProjectDir, config.GocConfig.CurWd[len(config.GocConfig.CurModProjectDir):]) config.GocConfig.TmpWd = filepath.Join(config.GocConfig.TmpModProjectDir, config.GocConfig.CurWd[len(config.GocConfig.CurModProjectDir):])
// get GlobalCoverVarImportPath // get GlobalCoverVarImportPath
config.GocConfig.GlobalCoverVarImportPath = path.Join(config.GocConfig.ImportPath, tmpFolderName(config.GocConfig.CurModProjectDir)) config.GocConfig.GlobalCoverVarImportPath = path.Join(config.GocConfig.ImportPath, TmpFolderName(config.GocConfig.CurModProjectDir))
log.Donef("project meta information parsed") log.Donef("project meta information parsed")
} }

View File

@ -43,8 +43,8 @@ func (b *Build) copyProjectToTmp() {
log.StopWait() log.StopWait()
} }
// tmpFolderName generates a directory name according to the path // TmpFolderName generates a directory name according to the path
func tmpFolderName(path string) string { func TmpFolderName(path string) string {
sum := sha256.Sum256([]byte(path)) sum := sha256.Sum256([]byte(path))
h := fmt.Sprintf("%x", sum[:6]) h := fmt.Sprintf("%x", sum[:6])