Skip to content

Commit

Permalink
Use go:generate for columns
Browse files Browse the repository at this point in the history
  • Loading branch information
areed committed Feb 4, 2025
1 parent 27efcc1 commit 885fba5
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 121 deletions.
239 changes: 120 additions & 119 deletions nssdb/columns.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions nssdb/generate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ func main() {
os.Exit(1)
}

const templ = `// generated by nssdb/generate/main.go
const templ = `// Code generated by nssdb/generate/main.go. DO NOT EDIT.
//go:generate go run generate/main.go
package nssdb
var columns = map[string]string{
Expand All @@ -78,7 +79,12 @@ var columns = map[string]string{
if err != nil {
panic(err)
}
t.Execute(os.Stdout, columns)
f, err := os.Create("columns.go")
if err != nil {
panic(err)
}
defer f.Close()
t.Execute(f, columns)

log.Printf("Successfully generated column names for %d attributes\n", len(columns))
}
Expand Down

0 comments on commit 885fba5

Please sign in to comment.