mirror of
https://github.com/fumiama/gozel.git
synced 2026-06-12 12:30:33 +08:00
feat(gen): impl. all specs except union
This commit is contained in:
47
cmd/gen/api.go
Normal file
47
cmd/gen/api.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package main
|
||||
|
||||
import "os"
|
||||
|
||||
var apif *os.File
|
||||
|
||||
func init() {
|
||||
f, err := os.Create("api.go")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
apif = f
|
||||
apif.WriteString(`// Code generated by cmd/gen. DO NOT EDIT.
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2026 Fumiama Minamoto
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* @file api.go
|
||||
*
|
||||
*/
|
||||
|
||||
package gozel
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/fumiama/gozel/internal/zecall"
|
||||
)
|
||||
|
||||
func init() {
|
||||
`)
|
||||
}
|
||||
|
||||
func addAPI(name string) {
|
||||
apif.WriteString("\n\tif err := zecall.Register(\"")
|
||||
apif.WriteString(name)
|
||||
apif.WriteString("\"); err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"[gozel.warn]\", err)\n\t}\n")
|
||||
}
|
||||
|
||||
func closeAPI() {
|
||||
apif.WriteString("\n}\n")
|
||||
apif.Close()
|
||||
}
|
||||
Reference in New Issue
Block a user