main.gowires Echo routes and MySQL access; the app reads theconnstrenvironment variable at startup.models/holds sqlboiler-generated ORM structs plus integration-heavy tests; regenerate rather than editing by hand.tpl/contains view helpers and compiled gorazor templates undertpl/skins; author templates inskins/and regenerate to refresh code.static/css.gois the esc-generated asset bundle sourced fromoldweb/Template;migrate.sqltracks schema changes, withnotes/how.mdoutlining the production environment.oldweb/keeps the legacy ASP.NET implementation for reference only—avoid mixing new Go code there.
go run main.gostarts the API locally; exportconnstr="user:pass@tcp(localhost:3306)/blogwind"(or similar) beforehand.go build -o bin/goblogproduces a deployable binary that embeds templates and static assets.go test ./...exercises generated model tests and needs a MySQL instance matchingsqlboiler.toml; use a disposable schema to keep fixtures isolated.sqlboiler mysqlandgorazor skins tpl/skinsregenerate models and templates after database or view changes; runesc -o static/css.go -pkg static -include="(.+).css" -prefix="oldweb/" oldweb/Templatewhen CSS assets change.
- Format Go sources with
gofmt(orgo fmt ./...) before committing; keep imports ordered bygoimports. - Follow Go naming: exported identifiers use PascalCase, private helpers stay lowerCamelCase, and route handlers end with descriptive verbs (
home,blogger). - Keep generated directories (
models,tpl/skins,static/css.go) pristine; introduce handwritten logic in adjacent packages or helper files.
- Prefer unit tests for new logic alongside the files under test; integration specs can live next to sqlboiler suites but should guard their own fixtures.
- When running
go test ./models/..., ensure the MySQL schema is seeded with the data expected by the legacy blogwind tables. - Record any schema-dependent expectations in
migrate.sqland describe data requirements in the pull request.
- Emulate the existing history: short, imperative commit summaries (
Add nginx conf rule,Recover avatar). - Group related code-generation outputs and their sources in a single commit to ease review.
- PRs should explain the intent, reference related issues, note schema or asset regeneration steps, and attach screenshots or curl traces for user-facing changes when possible.