MCPcopy Index your code
hub / github.com/jetify-com/devbox / Hash

Method Hash

internal/devpkg/package.go:460–472  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

458var ErrCannotBuildPackageOnSystem = errors.New("unable to build for system")
459
460func (p *Package) Hash() string {
461 sum := ""
462 if p.installable.Ref.Type == flake.TypePath {
463 // For local flakes, use content hash of the flake.nix file to ensure
464 // user always gets newest flake.
465 sum, _ = cachehash.File(filepath.Join(p.installable.Ref.Path, "flake.nix"))
466 }
467
468 if sum == "" {
469 sum = cachehash.Bytes([]byte(cmp.Or(p.installable.String(), p.Raw)))
470 }
471 return sum[:min(len(sum), 6)]
472}
473
474// Equals compares two Packages. This may be an expensive operation since it
475// may have to normalize a Package's attribute path, which may require a network

Callers 1

FlakeInputNameMethod · 0.95

Calls 3

FileFunction · 0.92
BytesFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected