Documentation
¶
Index ¶
- type ModifiedFile
- type Report
- func (r Report) Diff(writer io.Writer) error
- func (r Report) Files() []ModifiedFile
- func (r Report) IsEmpty() bool
- func (r Report) Open(name string) (fs.File, error)
- func (r Report) Packages() []string
- func (r Report) WithRegexFilter(regex string) (Report, error)
- func (r Report) WithSpecialCasesFilter() Report
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ModifiedFile ¶
type ModifiedFile struct {
// contains filtered or unexported fields
}
ModifiedFile represents a file that has been modified by Orchestrion.
func NewModifiedFile ¶
func NewModifiedFile(fsys fs.FS, modifiedPath string) (ModifiedFile, error)
NewModifiedFile creates a new ModifiedFile from the given file system and modified path. If the modified file contains a line directive, it will parse it to find the original path.
func (ModifiedFile) ImportPath ¶
func (m ModifiedFile) ImportPath() string
ImportPath converts the modified file path to an import path.
func (ModifiedFile) String ¶
func (m ModifiedFile) String() string
type Report ¶
type Report struct {
// contains filtered or unexported fields
}
Report represents a collection of modified files that were generated by Orchestrion. It implements the fs.FS interface, allowing it to be used as a file system rooted in "/". This will open every file normally expect for files that have been modified by Orchestrion, in which case it will open the modified file instead of the original file.
func FromWorkDir ¶
FromWorkDir reads the orchestrion files from a `go build -work` directory and creates a Report out of it.
func (Report) Diff ¶
Diff generates a diff between the original and modified files and writes it to the writer.
func (Report) Files ¶
func (r Report) Files() []ModifiedFile
Files returns an iterator over the modified files in the report.
func (Report) Packages ¶
Packages returns an iterator over the unique package names found in the report. It extracts the package names from the file paths, assuming they follow the convention of being constructed as "<work-dir>/orchestrion/src/<github.com/my/repo>/<file.go>".
func (Report) WithRegexFilter ¶
WithRegexFilter filters the files in the report based on a regex pattern.
func (Report) WithSpecialCasesFilter ¶
WithSpecialCasesFilter filters the files in the report to include only those that are not weaver special cases