diff --git a/App.go b/App.go index ecc18b8..fcf2775 100644 --- a/App.go +++ b/App.go @@ -18,11 +18,16 @@ type App struct { posts map[string]*Post } -func (app *App) Init() { - app.html = loadClean("public/app.html") +func New() *App { + html := loadClean("public/app.html") css := loadClean("public/app.css") - app.html = strings.Replace(app.html, "{head}", fmt.Sprintf("{head}", css), 1) - app.posts = loadPosts("posts") + html = strings.Replace(html, "{head}", fmt.Sprintf("{head}", css), 1) + posts := loadPosts("posts") + + return &App{ + html: html, + posts: posts, + } } func (app *App) Run() { diff --git a/main.go b/main.go index a10028f..8427dc0 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,6 @@ package main func main() { - app := App{} - app.Init() + app := New() app.Run() }