README ¶ gcode a generate library for go code demo code := `package aa` bs, err := AddImport([]byte(code), "arr", "github.com/lingdor/magicarray") if err != nil { panic(err) } fmt.Println(string(bs)) output: package aa import( arr "github.com/lingdor/magicarray" ) Expand ▾ Collapse ▴ Documentation ¶ Index ¶ Variables func AddImport(code []byte, name, path string) ([]byte, error) Constants ¶ This section is empty. Variables ¶ View Source var ErrNoPackage = errors.New("no found package declaration") Functions ¶ func AddImport ¶ func AddImport(code []byte, name, path string) ([]byte, error) Types ¶ This section is empty. Source Files ¶ View all Source files err.go import.go Click to show internal directories. Click to hide internal directories.