Skip to content

Instantly share code, notes, and snippets.

@joseph0x45
Last active April 7, 2026 20:46
Show Gist options
  • Select an option

  • Save joseph0x45/512b253dba1c1dfbe86ddef79d9fb278 to your computer and use it in GitHub Desktop.

Select an option

Save joseph0x45/512b253dba1c1dfbe86ddef79d9fb278 to your computer and use it in GitHub Desktop.
Explaining my Go setup to LLMs

Here is the structure of my project.

.
├── go.mod
├── go.sum
├── internal
│   ├── buildinfo
│   │   └── buildinfo.go
│   ├── cli
│   │   └── cli.go
│   ├── db
│   │   ├── db.go
│   │   └── migrations.go
│   ├── handlers
│   │   ├── handler.go
│   │   └── routes.go
│   └── models
│       └── models.go
├── main.go
├── Makefile
├── tailwind.css
└── templates
    └── base.html

The "frontend" is made of HTML templates rendered by Go's html/template. I already provide the tailwind.css script at /tailwind so no need to include their cdn link. Each template has the following structure

{{define "template_name"}}
html content
{{end}}

When we need to compose templates we have a "parent" template that takes child templates. Looks like this

{{define "base"}}
<!DOCTYPE html>
<html lang="en">

<head>
  <title>{{.Title}}</title>
</head>

<body>
  {{.Content}}
</body>

</html>
{{end}}

The child template is parsed and turned into a string then injected into the parent. I only use that for sites where we have a clear base and all the pages can share the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment