doc: fix typo and improve docs for sorting

This commit is contained in:
decentral1se 2021-08-09 10:12:31 +02:00
parent 78d2fa7a60
commit 8c998c0043
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
2 changed files with 8 additions and 8 deletions

View File

@ -11,7 +11,7 @@ Package tagcmp provides image tag comparison operations\.
## Index ## Index
- [Variables](<#variables>) - [Variables](<#variables>)
- [func IsParseable(tag string) bool](<#func-isparseable>) - [func IsParsable(tag string) bool](<#func-isparsable>)
- [type ByTag](<#type-bytag>) - [type ByTag](<#type-bytag>)
- [func (t ByTag) Len() int](<#func-bytag-len>) - [func (t ByTag) Len() int](<#func-bytag-len>)
- [func (t ByTag) Less(i, j int) bool](<#func-bytag-less>) - [func (t ByTag) Less(i, j int) bool](<#func-bytag-less>)
@ -57,17 +57,17 @@ StringPattern matches when tags are only made up of alphabetic characters
var StringPattern = "^[a-zA-Z]+$" var StringPattern = "^[a-zA-Z]+$"
``` ```
## func IsParseable ## func IsParsable
```go ```go
func IsParseable(tag string) bool func IsParsable(tag string) bool
``` ```
IsParseable determines if a tag is supported by this library IsParsable determines if a tag is supported by this library
## type ByTag ## type ByTag
ByTag sorts tags ByTag sorts tags in asc/desc order where the last element is the latest tag\.
```go ```go
type ByTag []Tag type ByTag []Tag

View File

@ -18,7 +18,7 @@ type Tag struct {
UsesV bool // whether or not the tag uses the "v" prefix UsesV bool // whether or not the tag uses the "v" prefix
} }
// ByTag sorts tags // ByTag sorts tags in asc/desc order where the last element is the latest tag.
type ByTag []Tag type ByTag []Tag
func (t ByTag) Len() int { return len(t) } func (t ByTag) Len() int { return len(t) }
@ -299,8 +299,8 @@ func Parse(tag string) (Tag, error) {
return parsedTag, nil return parsedTag, nil
} }
// IsParseable determines if a tag is supported by this library // IsParsable determines if a tag is supported by this library
func IsParseable(tag string) bool { func IsParsable(tag string) bool {
if _, err := Parse(tag); err != nil { if _, err := Parse(tag); err != nil {
return false return false
} }