MCPcopy Index your code
hub / github.com/commitdev/zero / GetSourceDir

Function GetSourceDir

internal/module/module.go:45–54  ·  view source on GitHub ↗

GetSourcePath gets a unique local source directory name. For local modules, it use the local directory

(source string)

Source from the content-addressed store, hash-verified

43
44// GetSourcePath gets a unique local source directory name. For local modules, it use the local directory
45func GetSourceDir(source string) string {
46 if !IsLocal(source) {
47 h := md5.New()
48 io.WriteString(h, source)
49 source = base64.StdEncoding.EncodeToString(h.Sum(nil))
50 return path.Join(constants.TemplatesDir, source)
51 } else {
52 return source
53 }
54}
55
56// IsLocal uses the go-getter FileDetector to check if source is a file
57func IsLocal(source string) bool {

Callers 5

TestGetSourceDirFunction · 0.92
modulesWalkCmdFunction · 0.92
GenerateFunction · 0.92
FetchModuleFunction · 0.85
ParseModuleConfigFunction · 0.85

Calls 1

IsLocalFunction · 0.85

Tested by 1

TestGetSourceDirFunction · 0.74