diff --git a/docs/docGeneration.go b/docs/docGeneration.go index 2b7069e4..6c5d9a93 100644 --- a/docs/docGeneration.go +++ b/docs/docGeneration.go @@ -98,6 +98,8 @@ func CreatePackageDocs(fs afero.Fs, repo Repo, templatePath string, excludedPack excludedPackagesMap[pkg] = struct{}{} } + printFs(fs, ".", "") + exists, err := afero.Exists(fs, templatePath) if err != nil { return fmt.Errorf("error checking if template file exists: %w", err) @@ -111,6 +113,8 @@ func CreatePackageDocs(fs afero.Fs, repo Repo, templatePath string, excludedPack return fmt.Errorf("error walking directories: %w", err) } + printFs(fs, ".", "") + fmt.Println("Package docs created.") return nil } @@ -148,6 +152,8 @@ func generateReadmeFromTemplate(fs afero.Fs, pkgDoc *PackageDoc, path string, te return fmt.Errorf("template file does not exist") } + fmt.Printf("[DEBUG] Using template at path: %s\n", templatePath) + // Open the template file templateFile, err := fs.Open(templatePath) if err != nil { @@ -166,6 +172,8 @@ func generateReadmeFromTemplate(fs afero.Fs, pkgDoc *PackageDoc, path string, te if err != nil { return err } + fmt.Println("[DEBUG] Template parsed successfully.") + fmt.Println("[DEBUG] Template processed for:", path) // Open the output file out, err := fs.Create(path) @@ -181,6 +189,8 @@ func generateReadmeFromTemplate(fs afero.Fs, pkgDoc *PackageDoc, path string, te return err } + fmt.Printf("[DEBUG] PackageDoc for %s: %+v\n", path, pkgDoc) + // Replace " with " readmeContent := strings.ReplaceAll(buf.String(), """, "\"") @@ -192,6 +202,11 @@ func generateReadmeFromTemplate(fs afero.Fs, pkgDoc *PackageDoc, path string, te return err } + fmt.Println("[DEBUG] README generated for:", path) + + fmt.Println("[DEBUG] Contents after generating README:") + printFs(fs, ".", "") + return nil } @@ -203,7 +218,8 @@ func loadIgnoreList(fs afero.Fs, ignoreFilePath string) (map[string]struct{}, er if os.IsNotExist(err) { return ignoreList, nil // If the ignore file doesn't exist, just return the empty list. } - return nil, err + // Let's not return the error if the file doesn't exist, instead, handle it gracefully. + return ignoreList, nil } defer ignoreFile.Close() @@ -223,38 +239,48 @@ func loadIgnoreList(fs afero.Fs, ignoreFilePath string) (map[string]struct{}, er func handleDirectory(fs afero.Fs, repo Repo, templatePath string, excludedPackagesMap map[string]struct{}) filepath.WalkFunc { return func(path string, info os.FileInfo, err error) error { + fmt.Println("[DEBUG] Handling directory:", path) + + // General error handling if err != nil { return err } + // If it's not a directory, we just skip it if !info.IsDir() { return nil } + // Load the ignore list ignoreList, err := loadIgnoreList(fs, ".docgenignore") if err != nil { return fmt.Errorf("error loading ignore list: %w", err) } + // Check if the current path is in the ignore list _, ignored := ignoreList[filepath.Clean(path)] if ignored { return filepath.SkipDir } + // Check if directory contains Go files hasGoFiles, err := directoryContainsGoFiles(fs, path) if err != nil { return err } + // If the directory does not have Go files, skip it if !hasGoFiles { return nil } + // Process Go files in the directory return processGoFiles(fs, path, repo, templatePath, excludedPackagesMap) } } func directoryContainsGoFiles(fs afero.Fs, path string) (bool, error) { + entries, err := afero.ReadDir(fs, path) if err != nil { return false, err @@ -264,11 +290,18 @@ func directoryContainsGoFiles(fs afero.Fs, path string) (bool, error) { if entry.IsDir() { continue } - if strings.HasSuffix(entry.Name(), ".go") && - !strings.HasSuffix(entry.Name(), "_test.go") && - !strings.HasSuffix(entry.Name(), "magefile.go") { + + hasGoFile := strings.HasSuffix(entry.Name(), ".go") + // hasTestFile := strings.HasSuffix(entry.Name(), "_test.go") + // isTmpl := strings.HasSuffix(entry.Name(), ".tmpl") + + fmt.Println("[DEBUG] Directory has Go files:", path, hasGoFile) + // Check if the file is a regular Go file (excluding test files and templates) + if hasGoFile { + // if isGoFile && !isTestFile && !isTmpl { return true, nil } + } return false, nil @@ -276,17 +309,49 @@ func directoryContainsGoFiles(fs afero.Fs, path string) (bool, error) { func processGoFiles(fs afero.Fs, path string, repo Repo, templatePath string, excludedPackagesMap map[string]struct{}) error { fset := token.NewFileSet() - pkgs, err := parser.ParseDir(fset, path, nonTestFilter, parser.ParseComments) + fmt.Println("Trying to parse directory:", path) + + files, _ := afero.ReadDir(fs, path) + for _, file := range files { + fmt.Println("File inside directory:", file.Name()) + } + + printFs(fs, ".", "") + + // 1. Create a temporary directory + tempDir, err := os.MkdirTemp("", "parserTemp") + if err != nil { + return err + } + defer os.RemoveAll(tempDir) // Ensure cleanup + + // 2. Copy files from afero to the temporary directory + aferoFiles, _ := afero.ReadDir(fs, path) + for _, file := range aferoFiles { + data, _ := afero.ReadFile(fs, filepath.Join(path, file.Name())) + if err := os.WriteFile(filepath.Join(tempDir, file.Name()), data, file.Mode()); err != nil { + return err + } + } + + // 3. Point the parser to the temporary directory + pkgs, err := parser.ParseDir(fset, tempDir, nonTestFilter, parser.ParseComments) if err != nil { return err } for _, pkg := range pkgs { + fmt.Println("[DEBUG] Package Name before:", pkg.Name) + + if filepath.Base(path) == "magefiles" && pkg.Name == "main" { + pkg.Name = "magefiles" // Magefiles are treated as a separate package for documentation + } + fmt.Println("[DEBUG] Package Name after:", pkg.Name) + // check if the package name is in the excluded packages list if _, exists := excludedPackagesMap[pkg.Name]; exists { continue // skip this package } - err := generateReadmeForPackage(fs, path, fset, pkg, repo, templatePath) if err != nil { return err @@ -301,6 +366,8 @@ func nonTestFilter(info os.FileInfo) bool { } func generateReadmeForPackage(fs afero.Fs, path string, fset *token.FileSet, pkg *ast.Package, repo Repo, templatePath string) error { + fmt.Println("Generating README for:", path) // Add this + pkgDoc := &PackageDoc{ PackageName: pkg.Name, GoGetPath: fmt.Sprintf("github.com/%s/%s/%s", repo.Owner, repo.Name, pkg.Name), @@ -319,6 +386,10 @@ func generateReadmeForPackage(fs afero.Fs, path string, fset *token.FileSet, pkg return pkgDoc.Functions[i].Name < pkgDoc.Functions[j].Name }) + fmt.Println("Template Path:", templatePath) + + fmt.Printf("[DEBUG] Path to generate README.md: %s\n", filepath.Join(path, "README.md")) + return generateReadmeFromTemplate(fs, pkgDoc, filepath.Join(path, "README.md"), templatePath) } @@ -345,11 +416,19 @@ func processFileDeclarations(fset *token.FileSet, pkgDoc *PackageDoc, file *ast. func createFunctionDoc(fset *token.FileSet, fn *ast.FuncDecl) (FunctionDoc, error) { var params, results, structName string + var err error if fn.Type.Params != nil { - params = formatNode(fset, fn.Type.Params) + params, err = formatNode(fset, fn.Type.Params) + if err != nil { + return FunctionDoc{}, fmt.Errorf("error formatting function parameters: %w", err) + } + } if fn.Type.Results != nil { - results = formatNode(fset, fn.Type.Results) + results, err = formatNode(fset, fn.Type.Results) + if err != nil { + return FunctionDoc{}, fmt.Errorf("error formatting function results: %w", err) + } } // Extract receiver (struct) name @@ -392,27 +471,45 @@ func splitLongSignature(signature string, maxLineLength int) string { return strings.Join(parts, "") } -func formatNode(fset *token.FileSet, node interface{}) string { +func formatNode(fset *token.FileSet, node interface{}) (string, error) { switch n := node.(type) { case *ast.FieldList: - return fieldListString(fset, n) + outStr, err := fieldListString(fset, n) + if err != nil { + return "", err + } + return outStr, nil default: var buf bytes.Buffer err := printer.Fprint(&buf, fset, node) if err != nil { - return fmt.Sprintf("error printing syntax tree: %v", err) + return "", fmt.Errorf("error printing syntax tree: %w", err) } - return buf.String() + return buf.String(), nil } } -func fieldListString(fset *token.FileSet, fieldList *ast.FieldList) string { +func fieldListString(fset *token.FileSet, fieldList *ast.FieldList) (string, error) { var buf strings.Builder for i, field := range fieldList.List { if i > 0 { buf.WriteString(", ") } - buf.WriteString(formatNode(fset, field.Type)) + fieldString, err := formatNode(fset, field.Type) + if err != nil { + return "", err + } + buf.WriteString(fieldString) + } + return buf.String(), nil +} + +func printFs(fs afero.Fs, dir string, indent string) { + entries, _ := afero.ReadDir(fs, dir) + for _, entry := range entries { + fmt.Printf("%s%s\n", indent, entry.Name()) + if entry.IsDir() { + printFs(fs, filepath.Join(dir, entry.Name()), indent+" ") + } } - return buf.String() } diff --git a/docs/docGeneration_test.go b/docs/docGeneration_test.go index ad007b4f..bbde49b9 100644 --- a/docs/docGeneration_test.go +++ b/docs/docGeneration_test.go @@ -1,10 +1,14 @@ package docs_test import ( + "fmt" "path/filepath" + "strings" "testing" "github.com/l50/goutils/v2/docs" + "github.com/l50/goutils/v2/git" + "github.com/l50/goutils/v2/sys" "github.com/spf13/afero" ) @@ -17,20 +21,62 @@ var repo = docs.Repo{ func TestCreatePackageDocs(t *testing.T) { templatePath := filepath.Join("magefiles", "tmpl", "README.md.tmpl") tests := []struct { - name string - repo docs.Repo - templatePath string - excludedPkgs []string - setupFs func() afero.Fs - expectErr bool + name string + repo docs.Repo + templatePath string + excludedPkgs []string + setupFs func() afero.Fs + expectErr bool + expectPkgName string }{ { name: "valid template path", repo: repo, setupFs: func() afero.Fs { - fs := afero.NewMemMapFs() + baseFs := afero.NewOsFs() + templatePath, err := afero.TempDir(baseFs, "", "testDocs") + if err != nil { + panic(err) + } + fs := afero.NewBasePathFs(baseFs, templatePath) + + t.Log("templatePath: ", templatePath) + // Create magefiles and tmpl directories in in-memory FS + _ = fs.MkdirAll(filepath.Join("magefiles", "tmpl"), 0755) + // Write template file to in-memory FS _ = afero.WriteFile(fs, templatePath, []byte("{{.PackageName}}"), 0644) - _ = afero.WriteFile(fs, "go.mod", []byte("module github.com/"+repo.Owner+"/"+repo.Name), 0644) + + repoRoot, err := git.RepoRoot() + if err != nil { + panic(err) + } + + if err := copyFileToMockFs(afero.NewOsFs(), fs, filepath.Join(repoRoot, "magefiles", "go.mod"), filepath.Join("magefiles", "go.mod")); err != nil { + panic(err) + } + + if err := copyFileToMockFs(afero.NewOsFs(), fs, filepath.Join(repoRoot, "magefiles", "go.sum"), filepath.Join("magefiles", "go.sum")); err != nil { + panic(err) + } + + // Here, we're copying the real magefile.go into the mock filesystem. + if err := copyFileToMockFs(afero.NewOsFs(), fs, filepath.Join(repoRoot, "magefiles", "magefile.go"), filepath.Join("magefiles", "magefile.go")); err != nil { + panic(err) + } + + // Here, we're copying the real README.md.tmpl into the mock filesystem. + if err := copyFileToMockFs(afero.NewOsFs(), fs, filepath.Join(repoRoot, "magefiles", "tmpl", "README.md.tmpl"), filepath.Join("magefiles", "tmpl", "README.md.tmpl")); err != nil { + panic(err) + } + + if err := sys.Cd(templatePath); err != nil { + panic(err) + } + + if _, err := sys.RunCommand("git", "init"); err != nil { + panic(err) + } + return fs }, templatePath: templatePath, @@ -40,9 +86,30 @@ func TestCreatePackageDocs(t *testing.T) { name: "invalid template path", repo: repo, setupFs: func() afero.Fs { - fs := afero.NewMemMapFs() - _ = afero.WriteFile(fs, "template.tmpl", []byte("{{.PackageName}}"), 0644) - _ = afero.WriteFile(fs, "go.mod", []byte("module github.com/"+repo.Owner+"/"+repo.Name), 0644) + baseFs := afero.NewOsFs() + tempDir, err := afero.TempDir(baseFs, "", "testDocs") + if err != nil { + panic(err) + } + fs := afero.NewBasePathFs(baseFs, tempDir) + + // Create magefiles and tmpl directories in in-memory FS + _ = fs.MkdirAll(filepath.Join("magefiles", "tmpl"), 0755) + // Write template file to in-memory FS + _ = afero.WriteFile(fs, templatePath, []byte("{{.PackageName}}"), 0644) + // Mock README.md.tmpl content + _ = afero.WriteFile(fs, filepath.Join("magefiles", "tmpl", "README.md.tmpl"), []byte("mock README.md.tmpl content"), 0644) + + repoRoot, err := git.RepoRoot() + if err != nil { + panic(err) + } + + // Here, we're copying the real magefile.go into the mock filesystem. + if err := copyFileToMockFs(afero.NewOsFs(), fs, filepath.Join(repoRoot, "magefiles", "tmpl", "README.md.tmpl"), filepath.Join("magefiles", "tmpl", "README.md.tmpl")); err != nil { + panic(err) + } + return fs }, templatePath: "nonexistent_template.tmpl", @@ -90,15 +157,82 @@ func TestCreatePackageDocs(t *testing.T) { templatePath: templatePath, expectErr: false, }, + { + name: "magefiles directory with main package", + repo: repo, + setupFs: func() afero.Fs { + baseFs := afero.NewOsFs() + tempDir, err := afero.TempDir(baseFs, "", "testDocs") + if err != nil { + panic(err) + } + fs := afero.NewBasePathFs(baseFs, tempDir) + + // Create magefiles and tmpl directories in in-memory FS + _ = fs.MkdirAll(filepath.Join("magefiles", "tmpl"), 0755) + // Write template file to in-memory FS + _ = afero.WriteFile(fs, templatePath, []byte("{{.PackageName}}"), 0644) + // Mock README.md.tmpl content + _ = afero.WriteFile(fs, filepath.Join("magefiles", "tmpl", "README.md.tmpl"), []byte("mock README.md.tmpl content"), 0644) + + repoRoot, err := git.RepoRoot() + if err != nil { + panic(err) + } + + // Here, we're copying the real magefile.go into the mock filesystem. + if err := copyFileToMockFs(afero.NewOsFs(), fs, filepath.Join(repoRoot, "magefiles", "magefile.go"), filepath.Join("magefiles", "magefile.go")); err != nil { + panic(err) + } + + return fs + }, + templatePath: templatePath, + expectErr: false, + expectPkgName: "magefiles", + }, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { fs := tc.setupFs() - err := docs.CreatePackageDocs(fs, tc.repo, tc.templatePath) + printFs(fs, ".", "") + + // Check directory explicitly: + dirExists, _ := afero.DirExists(fs, "magefiles") + if !dirExists { + t.Error("magefiles directory does not exist in the in-memory file system") + } + if tc.expectPkgName != "" { + readmePath := filepath.Join("magefiles", "README.md") + content, err := afero.ReadFile(fs, readmePath) + if err == nil && !strings.Contains(string(content), tc.expectPkgName) { + t.Errorf("expected package name %s not found in generated README", tc.expectPkgName) + } + } + err := docs.CreatePackageDocs(fs, tc.repo, tc.templatePath, tc.excludedPkgs...) if (err != nil) != tc.expectErr { t.Errorf("CreatePackageDocs() error = %v, expectErr %v", err, tc.expectErr) } }) } } + +func printFs(fs afero.Fs, dir string, indent string) { + entries, _ := afero.ReadDir(fs, dir) + for _, entry := range entries { + fmt.Printf("%s%s\n", indent, entry.Name()) + if entry.IsDir() { + printFs(fs, filepath.Join(dir, entry.Name()), indent+" ") + } + } +} + +func copyFileToMockFs(srcFs afero.Fs, destFs afero.Fs, srcPath, destPath string) error { + content, err := afero.ReadFile(srcFs, srcPath) + if err != nil { + return err + } + + return afero.WriteFile(destFs, destPath, content, 0644) +} diff --git a/go.sum b/go.sum index f7d8f24b..a5375bb1 100644 --- a/go.sum +++ b/go.sum @@ -219,8 +219,6 @@ github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde h1:x0TT0RDC7UhAVbbWWBzr41ElhJx5tXPWkIHA2HWPRuw= github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0= -github.com/otiai10/copy v1.12.0 h1:cLMgSQnXBs1eehF0Wy/FAGsgDTDmAqFR7rQylBb1nDY= -github.com/otiai10/copy v1.12.0/go.mod h1:rSaLseMUsZFFbsFGc7wCJnnkTAvdc5L6VWxPE4308Ww= github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks= diff --git a/magefiles/README.md b/magefiles/README.md new file mode 100644 index 00000000..b63f9e48 --- /dev/null +++ b/magefiles/README.md @@ -0,0 +1,176 @@ +# goutils/v2/magefiles + +The `magefiles` package is a collection of utility functions +designed to simplify common magefiles tasks. + +Table of contents: + +- [Functions](#functions) +- [Installation](#installation) +- [Usage](#usage) +- [Tests](#tests) +- [Contributing](#contributing) +- [License](#license) + +--- + +## Functions + +### GeneratePackageDocs() + +```go +GeneratePackageDocs() error +``` + +GeneratePackageDocs creates documentation for the various packages +in the project. + +**Returns:** + +error: An error if any issue occurs during documentation generation. + +--- + +### InstallDeps() + +```go +InstallDeps() error +``` + +InstallDeps installs the Go dependencies necessary for developing +on the project. + +**Returns:** + +error: An error if any issue occurs while trying to +install the dependencies. + +--- + +### RunPreCommit() + +```go +RunPreCommit() error +``` + +RunPreCommit updates, clears, and executes all pre-commit hooks +locally. The function follows a three-step process: + + 1. Updates the pre-commit hooks using lint.UpdatePCHooks. + 2. Clears the pre-commit cache with lint.ClearPCCache to ensure + a clean environment. + 3. Executes all pre-commit hooks locally using lint.RunPCHooks. + +**Returns:** + +error: An error if any issue occurs at any of the three stages +of the process. + +--- + +### RunTests() + +```go +RunTests() error +``` + +RunTests executes all unit tests. + +**Returns:** + +error: An error if any issue occurs while running the tests. + +--- + +### UpdateMirror(string) + +```go +UpdateMirror(string) error +``` + +UpdateMirror updates pkg.go.dev with the release associated with the +input tag + +**Parameters:** + +tag: the tag to update pkg.go.dev with + +**Returns:** + +error: An error if any issue occurs while updating pkg.go.dev + +--- + +### UseFixCodeBlocks(string, string) + +```go +UseFixCodeBlocks(string, string) error +``` + +UseFixCodeBlocks fixes code blocks for the input filepath +using the input language. + +**Parameters:** + +filepath: the path to the file or directory to fix + +language: the language of the code blocks to fix + +**Returns:** + +error: an error if one occurred + +Example: + +```go +mage fixcodeblocks docs/docGeneration.go go +``` + +--- + +## Installation + +To use the goutils/v2/magefiles package, you first need to install it. +Follow the steps below to install via go get. + +```bash +go get github.com/l50/goutils/v2/magefiles +``` + +--- + +## Usage + +After installation, you can import the package in your Go project +using the following import statement: + +```go +import "github.com/l50/goutils/v2/magefiles" +``` + +--- + +## Tests + +To ensure the package is working correctly, run the following +command to execute the tests for `goutils/v2/magefiles`: + +```bash +go test -v +``` + +--- + +## Contributing + +Pull requests are welcome. For major changes, +please open an issue first to discuss what +you would like to change. + +--- + +## License + +This project is licensed under the MIT +License - see the [LICENSE](../LICENSE) +file for details. diff --git a/magefiles/go.mod b/magefiles/go.mod index b03b319d..30026641 100644 --- a/magefiles/go.mod +++ b/magefiles/go.mod @@ -11,15 +11,16 @@ require ( require ( dario.cat/mergo v1.0.0 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect github.com/acomagu/bufpipe v1.0.4 // indirect github.com/bitfield/script v0.22.0 // indirect github.com/cloudflare/circl v1.3.3 // indirect + github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/fatih/color v1.15.0 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect - github.com/go-git/go-billy/v5 v5.4.1 // indirect - github.com/go-git/go-git/v5 v5.8.1 // indirect + github.com/go-git/go-billy/v5 v5.5.0 // indirect + github.com/go-git/go-git/v5 v5.9.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/itchyny/gojq v0.12.13 // indirect github.com/itchyny/timefmt-go v0.1.5 // indirect @@ -27,17 +28,20 @@ require ( github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/otiai10/copy v1.12.0 // indirect + github.com/otiai10/copy v1.14.0 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/sergi/go-diff v1.3.1 // indirect github.com/skeema/knownhosts v1.2.0 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect - golang.org/x/crypto v0.12.0 // indirect + golang.org/x/crypto v0.13.0 // indirect golang.org/x/mod v0.12.0 // indirect - golang.org/x/net v0.14.0 // indirect - golang.org/x/sys v0.11.0 // indirect - golang.org/x/text v0.12.0 // indirect - golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 // indirect + golang.org/x/net v0.15.0 // indirect + golang.org/x/sync v0.3.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.13.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect mvdan.cc/sh/v3 v3.6.0 // indirect ) + +replace github.com/l50/goutils/v2/docs => /Users/l/programs/go/src/github.com/l50/goutils/docs diff --git a/magefiles/go.sum b/magefiles/go.sum index 0db33bac..36b6fd20 100644 --- a/magefiles/go.sum +++ b/magefiles/go.sum @@ -43,8 +43,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 h1:KLq8BE0KwCL+mmXnjLWEAOYO+2l2AE4YMmqG1ZpZHBs= -github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= @@ -66,11 +66,13 @@ github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnht github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= +github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= +github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/elazarl/goproxy v0.0.0-20221015165544-a0805db90819 h1:RIB4cRk+lBqKK3Oy0r2gRX4ui7tuhiZq2SuTtTCi0/0= -github.com/elazarl/goproxy v0.0.0-20221015165544-a0805db90819/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= +github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU= +github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -87,12 +89,12 @@ github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= -github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= -github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= +github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= +github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f h1:Pz0DHeFij3XFhoBRGUDPzSJ+w2UcK5/0JvF8DRI58r8= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f/go.mod h1:8LHG1a3SRW71ettAD/jW13h8c6AqjVSeL11RAdgaqpo= -github.com/go-git/go-git/v5 v5.8.1 h1:Zo79E4p7TRk0xoRgMq0RShiTHGKcKI4+DI6BfJc/Q+A= -github.com/go-git/go-git/v5 v5.8.1/go.mod h1:FHFuoD6yGz5OSKEBK+aWN9Oah0q54Jxl0abmj6GnqAo= +github.com/go-git/go-git/v5 v5.9.0 h1:cD9SFA7sHVRdJ7AYck1ZaAa/yeuBvGPxwXDL8cxrObY= +github.com/go-git/go-git/v5 v5.9.0/go.mod h1:RKIqga24sWdMGZF+1Ekv9kylsDz6LzdTSI2s/OsZWE0= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -173,7 +175,6 @@ github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -193,9 +194,10 @@ github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/otiai10/copy v1.12.0 h1:cLMgSQnXBs1eehF0Wy/FAGsgDTDmAqFR7rQylBb1nDY= -github.com/otiai10/copy v1.12.0/go.mod h1:rSaLseMUsZFFbsFGc7wCJnnkTAvdc5L6VWxPE4308Ww= +github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= +github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= +github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= +github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks= github.com/otiai10/mint v1.5.1/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= @@ -211,8 +213,9 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= @@ -253,8 +256,8 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -328,8 +331,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= -golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= +golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -398,16 +401,16 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= -golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= +golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -419,8 +422,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -473,8 +476,8 @@ golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 h1:Vve/L0v7CXXuxUmaMGIEK/dEeq7uiqb5qBgQrZzIE7E= -golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/magefiles/magefile.go b/magefiles/magefile.go index b0edaea9..4f30f096 100644 --- a/magefiles/magefile.go +++ b/magefiles/magefile.go @@ -1,10 +1,10 @@ //go:build mage +// +build mage package main import ( "fmt" - "log" "os" "path/filepath" @@ -23,7 +23,13 @@ func init() { os.Setenv("GO111MODULE", "on") } -// InstallDeps Installs go dependencies +// InstallDeps installs the Go dependencies necessary for developing +// on the project. +// +// **Returns:** +// +// error: An error if any issue occurs while trying to +// install the dependencies. func InstallDeps() error { fmt.Println("Installing dependencies.") @@ -42,24 +48,12 @@ func InstallDeps() error { return nil } -// FindExportedFuncsWithoutTests finds exported functions without tests -func FindExportedFuncsWithoutTests(pkg string) ([]string, error) { - funcs, err := mageutils.FindExportedFuncsWithoutTests(os.Args[1]) - - if err != nil { - log.Fatalf("failed to find exported functions without tests: %v", err) - } - - for _, funcName := range funcs { - fmt.Println(funcName) - } - - return funcs, nil - -} - -// GeneratePackageDocs generates package documentation -// for packages in the current directory and its subdirectories. +// GeneratePackageDocs creates documentation for the various packages +// in the project. +// +// **Returns:** +// +// error: An error if any issue occurs during documentation generation. func GeneratePackageDocs() error { fs := afero.NewOsFs() @@ -84,7 +78,18 @@ func GeneratePackageDocs() error { return nil } -// RunPreCommit runs all pre-commit hooks locally +// RunPreCommit updates, clears, and executes all pre-commit hooks +// locally. The function follows a three-step process: +// +// 1. Updates the pre-commit hooks using lint.UpdatePCHooks. +// 2. Clears the pre-commit cache with lint.ClearPCCache to ensure +// a clean environment. +// 3. Executes all pre-commit hooks locally using lint.RunPCHooks. +// +// **Returns:** +// +// error: An error if any issue occurs at any of the three stages +// of the process. func RunPreCommit() error { fmt.Println("Updating pre-commit hooks.") if err := lint.UpdatePCHooks(); err != nil { @@ -104,7 +109,11 @@ func RunPreCommit() error { return nil } -// RunTests runs all of the unit tests +// RunTests executes all unit tests. +// +// **Returns:** +// +// error: An error if any issue occurs while running the tests. func RunTests() error { mg.Deps(InstallDeps) @@ -116,7 +125,16 @@ func RunTests() error { return nil } -// UpdateMirror updates pkg.go.dev with the release associated with the input tag +// UpdateMirror updates pkg.go.dev with the release associated with the +// input tag +// +// **Parameters:** +// +// tag: the tag to update pkg.go.dev with +// +// **Returns:** +// +// error: An error if any issue occurs while updating pkg.go.dev func UpdateMirror(tag string) error { var err error fmt.Printf("Updating pkg.go.dev with the new tag %s.", tag) @@ -138,31 +156,13 @@ func UpdateMirror(tag string) error { return nil } -// UpdateDocs updates the package documentation -// for packages in the current directory and its subdirectories. -func UpdateDocs() error { - repo := docs.Repo{ - Owner: "l50", - Name: "goutils/v2", - } - - fs := afero.NewOsFs() - - templatePath := filepath.Join("magefiles", "tmpl", "README.md.tmpl") - - if err := docs.CreatePackageDocs(fs, repo, templatePath); err != nil { - return fmt.Errorf("failed to update docs: %v", err) - } - - return nil -} - // UseFixCodeBlocks fixes code blocks for the input filepath // using the input language. // // **Parameters:** // // filepath: the path to the file or directory to fix +// // language: the language of the code blocks to fix // // **Returns:**