MCPcopy Create free account
hub / github.com/compose-spec/compose-go / ResolveRelativePaths

Function ResolveRelativePaths

paths/resolve.go:31–54  ·  view source on GitHub ↗

ResolveRelativePaths make relative paths absolute

(project map[string]any, base string, remotes []RemoteResource)

Source from the content-addressed store, hash-verified

29
30// ResolveRelativePaths make relative paths absolute
31func ResolveRelativePaths(project map[string]any, base string, remotes []RemoteResource) error {
32 r := relativePathsResolver{
33 workingDir: base,
34 remotes: remotes,
35 }
36 r.resolvers = map[tree.Path]resolver{
37 "services.*.build.context": r.absContextPath,
38 "services.*.build.additional_contexts.*": r.absContextPath,
39 "services.*.build.ssh.*": r.maybeUnixPath,
40 "services.*.env_file.*.path": r.absPath,
41 "services.*.label_file.*": r.absPath,
42 "services.*.extends.file": r.absExtendsPath,
43 "services.*.develop.watch.*.path": r.absSymbolicLink,
44 "services.*.volumes.*": r.absVolumeMount,
45 "configs.*.file": r.maybeUnixPath,
46 "secrets.*.file": r.maybeUnixPath,
47 "include.path": r.absPath,
48 "include.project_directory": r.absPath,
49 "include.env_file": r.absPath,
50 "volumes.*": r.volumeDriverOpts,
51 }
52 _, err := r.resolveRelativePaths(project, tree.NewPath())
53 return err
54}
55
56type RemoteResource func(path string) bool
57

Callers 2

getExtendsBaseFromFileFunction · 0.92
loadYamlModelFunction · 0.92

Calls 2

resolveRelativePathsMethod · 0.95
NewPathFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…