Lint on pkg/* packages
- pkg/useragent - pkg/units - pkg/ulimit - pkg/truncindex - pkg/timeoutconn - pkg/term - pkg/tarsum - pkg/tailfile - pkg/systemd - pkg/stringutils - pkg/stringid - pkg/streamformatter - pkg/sockets - pkg/signal - pkg/proxy - pkg/progressreader - pkg/pools - pkg/plugins - pkg/pidfile - pkg/parsers - pkg/parsers/filters - pkg/parsers/kernel - pkg/parsers/operatingsystem Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
a922d62168
commit
9bcb3cba83
56 changed files with 455 additions and 195 deletions
|
@ -1,3 +1,4 @@
|
|||
// Package stringid provides helper functions for dealing with string identifiers
|
||||
package stringid
|
||||
|
||||
import (
|
||||
|
@ -12,7 +13,7 @@ const shortLen = 12
|
|||
|
||||
var validShortID = regexp.MustCompile("^[a-z0-9]{12}$")
|
||||
|
||||
// Determine if an arbitrary string *looks like* a short ID.
|
||||
// IsShortID determines if an arbitrary string *looks like* a short ID.
|
||||
func IsShortID(id string) bool {
|
||||
return validShortID.MatchString(id)
|
||||
}
|
||||
|
@ -29,7 +30,7 @@ func TruncateID(id string) string {
|
|||
return id[:trimTo]
|
||||
}
|
||||
|
||||
// GenerateRandomID returns an unique id
|
||||
// GenerateRandomID returns an unique id.
|
||||
func GenerateRandomID() string {
|
||||
for {
|
||||
id := make([]byte, 32)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue