Command gencodec generates marshaling methods for Go struct types.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gencodec/vendor/github.com/garslo/gogen/import.go

32 lines
423 B

package gogen
import (
"fmt"
"go/ast"
"go/token"
)
type Import struct {
Name string
}
func (me Import) Declaration() ast.Decl {
return &ast.GenDecl{
Tok: token.IMPORT,
Specs: []ast.Spec{
&ast.ImportSpec{
Path: &ast.BasicLit{
Kind: token.STRING,
Value: fmt.Sprintf(`"%s"`, me.Name),
},
},
},
}
}
type Imports []Import
func (me *Imports) Add(imp Import) {
*me = append(*me, imp)
}