qrz/vendor/github.com/gobuffalo/packr/v2/file/resolver/resolver.go
Paul Lecuq 36c5d6f2ed
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is failing
large change on qrz
- web service with json support
- web page
- cron service to update database infos
2020-05-09 19:09:27 +02:00

34 lines
509 B
Go

package resolver
import (
"encoding/json"
"fmt"
"os"
"github.com/gobuffalo/packr/v2/file"
)
type Resolver interface {
Resolve(string, string) (file.File, error)
}
func defaultResolver() Resolver {
pwd, _ := os.Getwd()
return &Disk{
Root: pwd,
}
}
var DefaultResolver = defaultResolver()
func String(r Resolver) string {
m := map[string]interface{}{
"name": fmt.Sprintf("%T", r),
}
if fm, ok := r.(file.FileMappable); ok {
m["files"] = fm
}
b, _ := json.Marshal(m)
return string(b)
}