MCPcopy
hub / github.com/perkeep/perkeep / PkSourceRoot

Function PkSourceRoot

internal/osutil/paths.go:355–367  ·  view source on GitHub ↗

PkSourceRoot returns the root of the source tree, or an error.

()

Source from the content-addressed store, hash-verified

353
354// PkSourceRoot returns the root of the source tree, or an error.
355func PkSourceRoot() (string, error) {
356 root, err := GoModPackagePath()
357 if err == nil {
358 return root, nil
359 }
360 err = fmt.Errorf("could not found go.mod, trying GOPATH: %w", err)
361 root, errp := GoPackagePath("perkeep.org")
362 if errors.Is(errp, os.ErrNotExist) {
363 return "", fmt.Errorf("directory \"perkeep.org\" not found under GOPATH/src; "+
364 "can't run Perkeep integration tests: %v", errors.Join(err, errp))
365 }
366 return root, nil
367}
368
369// GoPackagePath returns the path to the provided Go package's
370// source directory.

Callers 15

fakePictureFunction · 0.92
fakePhotoFunction · 0.92
fakePhotoFunction · 0.92
fakePictureFunction · 0.92
TestQueryFileLocationFunction · 0.92
searchDescribeSetupFunction · 0.92
testSignerFunction · 0.92
initTestsFunction · 0.92
WorldFromConfigFunction · 0.92
NewIndexDepsFunction · 0.92

Calls 2

GoModPackagePathFunction · 0.85
GoPackagePathFunction · 0.85

Tested by 9

TestQueryFileLocationFunction · 0.74
searchDescribeSetupFunction · 0.74
testSignerFunction · 0.74
initTestsFunction · 0.74
doKeyStuffFunction · 0.74
TestInstallHandlersFunction · 0.74