generated from TrueCloudLab/basic
26 lines
558 B
Go
26 lines
558 B
Go
|
package testdata
|
||
|
|
||
|
import (
|
||
|
"path/filepath"
|
||
|
"runtime"
|
||
|
)
|
||
|
|
||
|
// basepath is the root directory of this package.
|
||
|
var basepath string
|
||
|
|
||
|
func init() {
|
||
|
_, currentFile, _, _ := runtime.Caller(0)
|
||
|
basepath = filepath.Dir(currentFile)
|
||
|
}
|
||
|
|
||
|
// Path returns the absolute path the given relative file or directory path,
|
||
|
// relative to the frostfs-observability/testdata directory in the user's GOPATH.
|
||
|
// If rel is already absolute, it is returned unmodified.
|
||
|
func Path(rel string) string {
|
||
|
if filepath.IsAbs(rel) {
|
||
|
return rel
|
||
|
}
|
||
|
|
||
|
return filepath.Join(basepath, rel)
|
||
|
}
|