2019-10-26 00:11:34 +03:00
|
|
|
package costello
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
2019-10-31 18:06:20 +03:00
|
|
|
"runtime"
|
2019-10-26 00:11:34 +03:00
|
|
|
|
|
|
|
"github.com/markbates/pkger/here"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Ref struct {
|
|
|
|
here.Info
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewRef() (*Ref, error) {
|
|
|
|
|
|
|
|
her, err := here.Package("github.com/markbates/pkger")
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
dir := filepath.Join(
|
2019-10-30 18:31:39 +03:00
|
|
|
her.Module.Dir,
|
2019-10-26 00:11:34 +03:00
|
|
|
"pkging",
|
|
|
|
"costello",
|
|
|
|
"testdata",
|
|
|
|
"ref")
|
|
|
|
|
|
|
|
if _, err := os.Stat(dir); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
ref := &Ref{
|
|
|
|
Info: here.Info{
|
|
|
|
ImportPath: "app",
|
|
|
|
Dir: dir,
|
2019-10-31 18:06:20 +03:00
|
|
|
Name: "app",
|
2019-10-30 18:31:39 +03:00
|
|
|
Module: here.Module{
|
2019-10-31 18:06:20 +03:00
|
|
|
Main: true,
|
|
|
|
Path: "app",
|
|
|
|
Dir: dir,
|
|
|
|
GoMod: filepath.Join(dir, "go.mod"),
|
|
|
|
GoVersion: runtime.Version(),
|
2019-10-30 18:31:39 +03:00
|
|
|
},
|
2019-10-26 00:11:34 +03:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
return ref, nil
|
|
|
|
}
|