mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
pkg/util/{filepath.go,shortid_generator.go}: Fix golint issues
See, $ gometalinter --vendor --deadline 10m --disable-all --enable=golint ./... filepath.go:12:5⚠️ error var WalkSkipDir should have name of the form ErrFoo (golint) shortid_generator.go:11:5⚠️ var validUidPattern should be validUIDPattern (golint) shortid_generator.go:19:6⚠️ func IsValidShortUid should be IsValidShortUID (golint) shortid_generator.go:24:6⚠️ func GenerateShortUid should be GenerateShortUID (golint)
This commit is contained in:
@@ -8,19 +8,19 @@ import (
|
||||
|
||||
var allowedChars = shortid.DefaultABC
|
||||
|
||||
var validUidPattern = regexp.MustCompile(`^[a-zA-Z0-9\-\_]*$`).MatchString
|
||||
var validUIDPattern = regexp.MustCompile(`^[a-zA-Z0-9\-\_]*$`).MatchString
|
||||
|
||||
func init() {
|
||||
gen, _ := shortid.New(1, allowedChars, 1)
|
||||
shortid.SetDefault(gen)
|
||||
}
|
||||
|
||||
// IsValidShortUid checks if short unique identifier contains valid characters
|
||||
func IsValidShortUid(uid string) bool {
|
||||
return validUidPattern(uid)
|
||||
// IsValidShortUID checks if short unique identifier contains valid characters
|
||||
func IsValidShortUID(uid string) bool {
|
||||
return validUIDPattern(uid)
|
||||
}
|
||||
|
||||
// GenerateShortUid generates a short unique identifier.
|
||||
func GenerateShortUid() string {
|
||||
// GenerateShortUID generates a short unique identifier.
|
||||
func GenerateShortUID() string {
|
||||
return shortid.MustGenerate()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user