Documentation
¶
Index ¶
- func AddAliasedImport(code, alias, path string) string
- func AddImport(code, path string) string
- func AddImportIfNotExist(code, path string) string
- func EditFile(filePath string, f func(content string) string) error
- func GetFileContent(filePath string) (string, error)
- func InsertAttribute(code, methodName, newAttribute string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAliasedImport ¶
AddAliasedImport adds a new aliased package import (e.g., alias "path/to/pkg").
func AddImport ¶
AddImport adds a new package import to Go source code using AST parsing. Falls back to regex-based approach if AST parsing fails.
func AddImportIfNotExist ¶
AddImportIfNotExist adds an import only if it doesn't already exist in the code.
func GetFileContent ¶
func InsertAttribute ¶
InsertAttribute inserts a new attribute into an already-called method. It handles both single-line and multi-line calls, deduplicating existing attributes.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.