github.com/mg98/scriptup@v0.1.0/pkg/scriptup/storage/storage_test.go (about)

     1  package storage
     2  
     3  import (
     4  	"os"
     5  	"path"
     6  	"runtime"
     7  )
     8  
     9  func init() {
    10  	// set working directory to project root
    11  	_, filename, _, _ := runtime.Caller(0)
    12  	dir := path.Join(path.Dir(filename), "../../..")
    13  	err := os.Chdir(dir)
    14  	if err != nil {
    15  		panic(err)
    16  	}
    17  }