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

Function IsLocal

internal/module/module.go:57–69  ·  view source on GitHub ↗

IsLocal uses the go-getter FileDetector to check if source is a file

(source string)

Source from the content-addressed store, hash-verified

55
56// IsLocal uses the go-getter FileDetector to check if source is a file
57func IsLocal(source string) bool {
58 pwd := util.GetCwd()
59
60 // ref: https://github.com/hashicorp/go-getter/blob/master/detect_test.go
61 out, err := getter.Detect(source, pwd, getter.Detectors)
62
63 match, err := regexp.MatchString("^file://.*", out)
64 if err != nil {
65 log.Panicf("invalid source format %s", err)
66 }
67
68 return match
69}
70
71func withPWD(pwd string) func(*getter.Client) error {
72 return func(c *getter.Client) error {

Callers 4

modulesWalkCmdFunction · 0.92
FetchModuleFunction · 0.85
GetSourceDirFunction · 0.85
TestIsLocalFunction · 0.85

Calls 1

GetCwdFunction · 0.92

Tested by 1

TestIsLocalFunction · 0.68