Skip to content

Commit

Permalink
docs(modx): add method documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Mar 19, 2021
1 parent f3bacc6 commit 30d25bb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modx/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"golang.org/x/mod/modfile"
)

// FindVersion returns the version for a module given the contents of a go.mod file.
func FindVersion(gomod []byte, module string) (string, error) {
m, err := modfile.Parse("go.mod", gomod, nil)
if err != nil {
Expand All @@ -20,6 +21,7 @@ func FindVersion(gomod []byte, module string) (string, error) {
return "", errors.Errorf("no go.mod entry found for: %s", module)
}

// MustFindVersion returns the version for a module given the contents of a go.mod file or panics.
func MustFindVersion(gomod []byte, module string) string {
v, err := FindVersion(gomod, module)
if err != nil {
Expand Down

0 comments on commit 30d25bb

Please sign in to comment.