From 71b46a89bb1fb9f283cb1cdbb812ae53bf8a5921 Mon Sep 17 00:00:00 2001 From: Scott Leggett Date: Fri, 18 Aug 2023 08:30:50 +0800 Subject: [PATCH] feat: export NextVersion() This makes the package importable. --- helper_test.go | 7 ------- main.go | 6 +++--- 2 files changed, 3 insertions(+), 10 deletions(-) delete mode 100644 helper_test.go diff --git a/helper_test.go b/helper_test.go deleted file mode 100644 index dbcc59d..0000000 --- a/helper_test.go +++ /dev/null @@ -1,7 +0,0 @@ -//nolint:deadcode -package main - -// NextVersion is a test fixture to expose the private nextVersion() function. -func NextVersion(path string) (string, error) { - return nextVersion(path) -} diff --git a/main.go b/main.go index acab49e..66a2035 100644 --- a/main.go +++ b/main.go @@ -59,9 +59,9 @@ func walkCommits(r *git.Repository, tagRefs map[string]string, order git.LogOrde return latestVersion, major, minor, patch, nil } -// nextVersion returns a string containing the next version based on the state +// NextVersion returns a string containing the next version based on the state // of the git repository in path. -func nextVersion(path string) (string, error) { +func NextVersion(path string) (string, error) { // open repository r, err := git.PlainOpenWithOptions(path, &git.PlainOpenOptions{DetectDotGit: true}) if err != nil { @@ -132,7 +132,7 @@ func main() { if err != nil { panic(err) } - next, err := nextVersion(`.`) + next, err := NextVersion(`.`) if err != nil { log.Fatal("couldn't get next version", zap.Error(err)) }