Quick Start
Upgrade Guide
Upgrade an existing GoLazy application from v0.1.9 to the latest release.
Upgrade from v0.1.9
GoLazy v0.1.10 focuses on application-flow helpers and a cleaner sample
application template. Existing v0.1.9 applications do not need a large
rewrite; adopt the helpers where they remove boilerplate.
Update the framework requirement:
go get golazy.dev@latest
go mod tidy
Read Install GoLazy for the current install and module setup flow.
Install or update the matching CLI so lazy new selects the latest sample
application template:
go install github.com/golazy/lazy@latest
lazy --version
Read Run With lazy for the development command and Full App for the generated application layout.
Form decoding
Replace local request-decoding helpers with the controller helper when the action is decoding a submitted form:
func (c *PostsController) GenCreateForm() (CreateForm, error) {
var form CreateForm
if err := c.Decode(&form); err != nil {
return CreateForm{}, err
}
return form, nil
}
Decode parses the current request form, applies lazyschema, and wraps
decode failures as bad-request HTTP errors.
Read Forms for form helpers, schema field names, and request decoding.
Route helpers
Use trailing lazycontroller.URLParams when a named route needs a query string:
adminPath := c.MustPathFor("admin_post", post.Param, lazycontroller.URLParams{
"token": post.AdminToken,
})
Use MustPathFor only when route names and parameters are application
invariants. Keep PathFor when an action should handle route-helper errors.
Read Controller Routes for named route helpers in controllers and templates.
Nested resources
Move manually nested member routes to nested resources when the child has REST semantics:
router.Resources(postcontroller.New, func(posts *lazyroutes.Resource) {
posts.Resources(commentcontroller.New)
})
This registers child routes below the parent member path and names them with
the parent singular suffix, such as comments_post.
Read REST Resources for conventional, custom, and nested resource routes.
Detailed errors
Applications launched by lazy use the lazydev build tag and show detailed
unexpected errors. Production builds hide details by default. During local
debugging of a production-style build, opt in explicitly:
lazyapp.App{
Config: lazyapp.Config{
ForceDetailErrors: true,
},
}
Unexpected errors are also logged to stderr.
Read Redirects, Metadata, And Errors for expected HTTP errors, response metadata, redirects, and detail-error behavior.
Application tests
Move full application HTTP tests to lazytest when they currently repeat
httptest setup and assertion code:
func TestApplication(t *testing.T) {
app := lazytest.New(t, appinit.App())
app.Cases(
lazytest.Case{
Name: "posts",
Method: http.MethodGet,
Path: "/posts",
Status: http.StatusOK,
Contains: []string{"Hello, GoLazy"},
ContentType: "text/html",
},
)
}
Read Release Verification and Controller Tests for test structure.
Generated app setup
The sample application now keeps development secrets under .secrets, reads
SECURE_COOKIE_KEY from the environment, includes Docker packaging, and uses
lazytest for integration tests. Existing apps can adopt those conventions
incrementally.
Read Configuration and Deployment for the current template layout.
Development reloads
lazy now fingerprints JavaScript package metadata before rebuilding. No
application change is needed; the dev loop should stop restarting on lockfile
mtime-only rewrites while still rebuilding when package content changes.
Read lazy Dev Loop Integration for generated asset rebuild behavior.
Versioned guide
Use the v0.1.9 upgrade guide when you need the exact
upgrade path from v0.1.8 to v0.1.9.