diff --git a/.gitignore b/.gitignore index 7b23249..d149a94 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ what-is-my-ip -rice-box.go diff --git a/rice-box.go b/rice-box.go new file mode 100644 index 0000000..3998887 --- /dev/null +++ b/rice-box.go @@ -0,0 +1,41 @@ +package main + +import ( + "github.com/GeertJohan/go.rice/embedded" + "time" +) + +func init() { + + // define files + file2 := &embedded.EmbeddedFile{ + Filename: "index.tmpl", + FileModTime: time.Unix(1576433620, 0), + Content: string("\n\n \n \n What is My IP?\n \n \n \n
{{.IP}}
\n \n\n"), + } + + // define dirs + dir1 := &embedded.EmbeddedDir{ + Filename: "", + DirModTime: time.Unix(1576433633, 0), + ChildFiles: []*embedded.EmbeddedFile{ + file2, // "index.tmpl" + + }, + } + + // link ChildDirs + dir1.ChildDirs = []*embedded.EmbeddedDir{} + + // register embeddedBox + embedded.RegisterEmbeddedBox(`templates`, &embedded.EmbeddedBox{ + Name: `templates`, + Time: time.Unix(1576433633, 0), + Dirs: map[string]*embedded.EmbeddedDir{ + "": dir1, + }, + Files: map[string]*embedded.EmbeddedFile{ + "index.tmpl": file2, + }, + }) +}