2019-11-11 01:09:08 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"app/actions"
|
|
|
|
|
|
|
|
"github.com/markbates/pkger"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2019-11-12 00:01:05 +03:00
|
|
|
pkger.Include("/web")
|
2019-11-11 01:09:08 +03:00
|
|
|
if err := run(); err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-21 18:19:19 +03:00
|
|
|
const (
|
|
|
|
unused, pathAsset = "", "/assets"
|
|
|
|
)
|
|
|
|
|
2019-11-11 01:09:08 +03:00
|
|
|
func run() error {
|
|
|
|
if err := actions.WalkTemplates(os.Stdout); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-05-21 18:19:19 +03:00
|
|
|
err := pkger.Walk(pathAsset, func(path string, info os.FileInfo, err error) error {
|
2019-11-11 01:09:08 +03:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
fmt.Println(path)
|
|
|
|
return nil
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func dynamic() error {
|
|
|
|
info, err := pkger.Stat("/go.mod")
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
fmt.Println(info)
|
|
|
|
|
|
|
|
if err := pkger.MkdirAll("/foo/bar/baz", 0755); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
f, err := pkger.Create("/foo/bar/baz/biz.txt")
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
f.Write([]byte("BIZ!!"))
|
|
|
|
|
|
|
|
if err := f.Close(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
f, err = pkger.Open("/foo/bar/baz/biz.txt")
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
io.Copy(os.Stdout, f)
|
|
|
|
|
|
|
|
return f.Close()
|
|
|
|
}
|