Fix up template

This commit is contained in:
2024-11-06 00:25:20 +01:00
parent bfe4767ead
commit 0e289d282a
3 changed files with 8 additions and 3 deletions

View File

@@ -3,7 +3,6 @@ package main
import ( import (
_ "embed" _ "embed"
"fmt" "fmt"
"log"
"os" "os"
"text/template" "text/template"
) )
@@ -26,7 +25,6 @@ func init() {
Error.Printf("Error parsing template: %v", err) Error.Printf("Error parsing template: %v", err)
return return
} }
log.Printf("%#v", functionTemplate)
} }
type ( type (

View File

@@ -1,2 +1,8 @@
---@diagnostic disable: missing-return, lowercase-global ---@diagnostic disable: missing-return, lowercase-global
function {{.Name}}({{range $index, $param := .Params}}{{if $index}}, {{end}}{{$param.Name}}: {{$param.Type}}{{end}}) end {{range .Arguments -}}
---@param {{.Name}} {{.Type}} {{.Description}}
{{end -}}
{{range .Returns -}}
---@return {{.Type}} {{.Name}} {{if .Description}}#{{.Description}}{{end}}
{{end -}}
function {{.Name}}({{range $index, $param := .Arguments}}{{if $index}}, {{end}}{{$param.Name}}{{end}}) end

View File

@@ -56,6 +56,7 @@ func main() {
Error.Printf("Error parsing HTML: %v", err) Error.Printf("Error parsing HTML: %v", err)
return return
} }
foo.Name = "JoinPermanentChannel"
log.Printf("%#v", foo) log.Printf("%#v", foo)
err = foo.WriteFile() err = foo.WriteFile()
if err != nil { if err != nil {