Documentation ¶
Overview ¶
Copyright © 2020 aggronmagi <czy463@163.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 aggronmagi <czy463@163.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func Content(filename string, original []byte, packageNames map[string]string) ([]byte, error)
- func GoFormat(in []byte) (out []byte, err error)
- func GoFormat2(in []byte) ([]byte, error)
- func GoimportsCmdFormat(in []byte) (out []byte, err error)
- func InstallOptionsWatchDog(dog func(cc *Options))
- func OptionGoimportsFormtat(in []byte) ([]byte, error)
- type Generator
- func (gen *Generator) BeginLine()
- func (gen *Generator) Bytes() (data []byte, err error)
- func (gen *Generator) Doc(doc *buildpb.DocDesc)
- func (gen *Generator) EndLine()
- func (gen *Generator) Error(err error, msgs ...string)
- func (gen *Generator) Fail(msgs ...string)
- func (gen *Generator) In()
- func (gen *Generator) Key(k string) string
- func (gen *Generator) LuaDoc(doc *buildpb.DocDesc)
- func (gen *Generator) Out()
- func (gen *Generator) P(str ...interface{})
- func (gen *Generator) Pf(fmts string, v ...interface{})
- func (gen *Generator) PopAndWrite()
- func (gen *Generator) Print(str ...interface{})
- func (gen *Generator) Printf(fmts string, v ...interface{})
- func (gen *Generator) Println(str ...interface{})
- func (gen *Generator) PushObj()
- func (gen *Generator) WriteString(str string)
- type GoObject
- type GoTemplate
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
var DefaultFuncMap = template.FuncMap{}
Functions ¶
func GoimportsCmdFormat ¶
func InstallOptionsWatchDog ¶
func InstallOptionsWatchDog(dog func(cc *Options))
InstallOptionsWatchDog install watch dog
func OptionGoimportsFormtat ¶
OptionGoimportsFormtat use the command line `goimports` command to format first. If an error is reported, use the default formatting method.
Types ¶
type Generator ¶
Generator 生成器
type GoTemplate ¶
func NewTemplate ¶
func NewTemplate(name string) (tpl *GoTemplate)
func (*GoTemplate) AddImportFunc ¶
func (tpl *GoTemplate) AddImportFunc(obj interface { Import(pkg, fun string) (_ string) })
func (*GoTemplate) Exec ¶
func (tpl *GoTemplate) Exec(obj interface{}) (data []byte, err error)
func (*GoTemplate) Parse ¶
func (tpl *GoTemplate) Parse(v string) error
func (*GoTemplate) PrepareTemplate ¶
func (tpl *GoTemplate) PrepareTemplate(preTpl map[string]string) (err error)