Documentation
¶
Index ¶
- func Diff(baseBranch string) (*utils.CmdOutput, error)
- func FindChangedFiles(rootGoModPath, baseRef, filterCmd string) ([]string, error)
- func GetChangedGoPackagesFromDiff(out bytes.Buffer, projectPath string, excludes []string, ...) ([]string, error)
- func GetGoModChangesFromDiff(lines bytes.Buffer) ([]string, error)
- func ModDiff(baseBranch, projectPath string) (*utils.CmdOutput, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindChangedFiles ¶
FindChangedFiles executes a git diff against a specified base reference and pipes the output through a user-defined grep command or sequence. The baseRef parameter specifies the base git reference for comparison (e.g., "main", "develop"). The filterCmd parameter should include the full command to be executed after git diff, such as "grep '_test.go$'" or "grep -v '_test.go$' | sort".
func GetChangedGoPackagesFromDiff ¶
func GetChangedGoPackagesFromDiff(out bytes.Buffer, projectPath string, excludes []string, fileMap map[string][]string) ([]string, error)
GetChangedGoPackagesFromDiff identifies the Go packages affected by changes in a Git diff output. It analyzes a buffer containing the output of a 'git diff' command, filtering the list of changed files to determine which Go packages have been affected based on the project's file map.
Parameters:
- out: A bytes.Buffer containing the 'git diff' command output. This output should list the changed files, one per line.
- projectPath: The root directory of the project within the repository. This parameter is used to filter files based on their paths. [Note: This functionality is currently commented out, ensure to uncomment the related line if you decide to use it.]
- excludes: A slice of strings representing paths to exclude from the analysis. This can be useful to ignore changes in certain directories or files that are not relevant to the package analysis.
- fileMap: A map where the key is a file path and the value is a slice of strings representing the Go import paths of the packages that file belongs to. This map is used to map changed files to their respective packages.
Returns:
- A slice of strings representing the unique Go packages that have changes. These packages are identified by their import paths.
- An error, which is nil in the current implementation but can be used to return errors encountered during the execution of the function.
Types ¶
This section is empty.