Start Here

Upgrade Guide

Upgrade an existing GoLazy application from v0.1.7 to v0.1.8.

By Guillermo Alvarez - Published - Updated

Upgrade from v0.1.7

GoLazy v0.1.8 is a coordinated framework, CLI, sample application, and website release. It adds controller action generators, route namespaces, Tailwind stylesheet tooling, and the lazy hot-reload development runner.

From an existing application, update the framework requirement:

go get golazy.dev@v0.1.8
go mod tidy

Install or update the matching CLI so lazy new selects the v0.1.8 sample application template:

go install github.com/golazy/lazy@v0.1.8
lazy --version

Development runner

lazy now builds a temporary binary, runs the application behind a local development proxy, watches application files, restarts after successful rebuilds, and reloads browser pages that received HTML responses.

Use direct Go commands when you want to avoid the development proxy:

go run ./cmd/app

Tailwind stylesheets

Applications can opt into Tailwind builds with:

lazy tailwind

The command compiles conventional app styles from app/styles/application.css to app/public/styles.css. Single-file apps use styles/application.css and public/styles.css.

Controller actions

Controller actions may now receive route parameters and generated request values directly:

func (c *PostsController) Show(postID int) error
func (c *PostsController) Create(input PostInput) error
func (c *PostsController) GenPostInput(r *http.Request) (PostInput, error)

Existing func(w http.ResponseWriter, r *http.Request) error actions continue to work. Add generated arguments only where they make the action clearer.

Route namespaces

Use namespaces when a route group should share path, route-name, route metadata, and view-directory prefixes:

router.Namespace("admin", func(admin *lazyroutes.Scope) {
    admin.Resources(posts.New)
})

Namespaced controller views render from nested directories such as app/views/admin/posts/index.html.tpl. They do not fall back to non-namespaced controller views.