MCPcopy Create free account
hub / github.com/goadesign/goa / relativeToWorkdir

Function relativeToWorkdir

eval/error.go:165–179  ·  view source on GitHub ↗

relativeToWorkdir returns file relative to the current working directory when possible, otherwise it returns file unchanged.

(file string)

Source from the content-addressed store, hash-verified

163// relativeToWorkdir returns file relative to the current working directory when
164// possible, otherwise it returns file unchanged.
165func relativeToWorkdir(file string) string {
166 wd, err := os.Getwd()
167 if err != nil {
168 return file
169 }
170 wd, err = filepath.Abs(wd)
171 if err != nil {
172 return file
173 }
174 rel, err := filepath.Rel(wd, file)
175 if err != nil {
176 return file
177 }
178 return rel
179}

Callers 4

computeErrorLocationFunction · 0.70
dslFuncLocationFunction · 0.70
dslDeclLocationFunction · 0.70

Calls

no outgoing calls

Tested by 2

dslDeclLocationFunction · 0.56