Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoFile ¶
type GoFile struct {
// contains filtered or unexported fields
}
GoFile holds information about a GO file
func New ¶
New will create a new GO file representation
Note that the filename cannot contain the folderpath, and the packageName/packagePath refers to the package that the file will belong to
func NewTestFile ¶
NewTestFile will create a new GO test file, with the "_test" filename suffix
Note that the 'filename' cannot contain the folderpath, and the 'packageName'/'packagePath' refers to the package that the file will belong to
func (*GoFile) AddCode ¶
AddCode will append the given string to the file source code body (below imports)
Note that the given string is expected to be valid go code. This method doesn't do any checks
func (*GoFile) PackageName ¶
PackageName will return the name of the package that the file belongs to
func (*GoFile) Save ¶
Save will save the file to disk, ready to be compiled
The headerTitle param is used to fill the signature header, at the beginning of the file (usually, the library name)
func (*GoFile) SourceCode ¶
SourceCode will return the content of the file, with the 'package' and 'import' keywords
The filepath param is used to optimize the file imports. It must contain the folderpath and filename information. Example: <folderpath>/<filename>
The headerTitle param is used to fill the signature header, at the beginning of the file (usually, the library name)