feat(monorel): match goreleaser comment style in generated .goreleaser.yaml

- Replace "Generated by monorel" header with goreleaser-style preamble
  ("This file is generated by monorel ... check the docs at goreleaser.com")
- Add modeline explainer comment block before the yaml-language-server line
- Add "you may remove this if you don't need go generate" comment inline
- Combine name_template comments into goreleaser-style single comment
  ("this name template makes the OS and Arch compatible with uname")
This commit is contained in:
AJ ONeal 2026-03-01 00:26:23 -07:00
parent 98bdc47746
commit f3eff585c4
No known key found for this signature in database

View File

@ -1188,11 +1188,16 @@ func goreleaserYAML(projectName string, bins []binary) string {
w := func(s string) { b.WriteString(s) } w := func(s string) { b.WriteString(s) }
wf := func(format string, args ...any) { fmt.Fprintf(&b, format, args...) } wf := func(format string, args ...any) { fmt.Fprintf(&b, format, args...) }
w("# This file is generated by monorel (github.com/therootcompany/golib/tools/monorel).\n")
w("# Make sure to check the documentation at https://goreleaser.com\n")
w("\n# The lines below are called `modelines`. See `:help modeline`\n")
w("# Feel free to remove those if you don't want/need to use them.\n")
w("# yaml-language-server: $schema=https://goreleaser.com/static/schema.json\n") w("# yaml-language-server: $schema=https://goreleaser.com/static/schema.json\n")
w("# vim: set ts=2 sw=2 tw=0 fo=cnqoj\n") w("# vim: set ts=2 sw=2 tw=0 fo=cnqoj\n")
w("# Generated by monorel (github.com/therootcompany/golib/tools/monorel)\n")
w("\nversion: 2\n") w("\nversion: 2\n")
w("\nbefore:\n hooks:\n - go mod tidy\n - go generate ./...\n") w("\nbefore:\n hooks:\n - go mod tidy\n")
w(" # you may remove this if you don't need go generate\n")
w(" - go generate ./...\n")
w("\nbuilds:\n") w("\nbuilds:\n")
for _, bin := range bins { for _, bin := range bins {
@ -1216,8 +1221,8 @@ func goreleaserYAML(projectName string, bins []binary) string {
wf(" - id: %s\n", bin.name) wf(" - id: %s\n", bin.name)
wf(" ids: [%s]\n", bin.name) wf(" ids: [%s]\n", bin.name)
w(" formats: [tar.gz, tar.zst]\n") w(" formats: [tar.gz, tar.zst]\n")
w(" # name_template uses VERSION env var so the prefixed monorepo tag\n") w(" # this name template makes the OS and Arch compatible with the results of `uname`.\n")
w(" # doesn't appear in archive filenames.\n") w(" # it uses the VERSION env var so the prefixed monorepo tag doesn't appear in archive filenames.\n")
w(" name_template: >-\n") w(" name_template: >-\n")
wf(" %s_{{ .Env.VERSION }}_\n", bin.name) wf(" %s_{{ .Env.VERSION }}_\n", bin.name)
w(" {{- title .Os }}_\n") w(" {{- title .Os }}_\n")