You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.0 KiB
Go
42 lines
1.0 KiB
Go
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("<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"UTF-8\" />\n <title>What is My IP?</title>\n <style type=\"text/css\">\n .ip {\n text-align: center;\n }\n </style>\n </head>\n <body>\n <code class=\"ip\"><pre>{{.IP}}</pre></code>\n </body>\n</html>\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,
|
|
},
|
|
})
|
|
}
|