mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
19 lines
493 B
Go
19 lines
493 B
Go
|
package models
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"path"
|
||
|
"runtime"
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
// move to project root as working directory (e.g. so data/* can be resolved when loading config)
|
||
|
// taken from https://intellij-support.jetbrains.com/hc/en-us/community/posts/360009685279-Go-test-working-directory-keeps-changing-to-dir-of-the-test-file-instead-of-value-in-template
|
||
|
_, filename, _, _ := runtime.Caller(0)
|
||
|
dir := path.Join(path.Dir(filename), "..")
|
||
|
err := os.Chdir(dir)
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
}
|