Comment convention fixes

pull/1121/head
Ville Skyttä 4 years ago
parent 803cea9d67
commit 5d0724f42f

@ -94,7 +94,7 @@ func (i FakeInvoke) CommandWithContext(ctx context.Context, name string, arg ...
var ErrNotImplementedError = errors.New("not implemented yet") var ErrNotImplementedError = errors.New("not implemented yet")
// ReadFile reads contents from a file // ReadFile reads contents from a file.
func ReadFile(filename string) (string, error) { func ReadFile(filename string) (string, error) {
content, err := ioutil.ReadFile(filename) content, err := ioutil.ReadFile(filename)
@ -111,7 +111,7 @@ func ReadLines(filename string) ([]string, error) {
return ReadLinesOffsetN(filename, 0, -1) return ReadLinesOffsetN(filename, 0, -1)
} }
// ReadLines reads contents from file and splits them by new line. // ReadLinesOffsetN reads contents from file and splits them by new line.
// The offset tells at which line number to start. // The offset tells at which line number to start.
// The count determines the number of lines to read (starting from offset): // The count determines the number of lines to read (starting from offset):
// n >= 0: at most n lines // n >= 0: at most n lines
@ -224,31 +224,31 @@ func ReadInts(filename string) ([]int64, error) {
return ret, nil return ret, nil
} }
// Parse Hex to uint32 without error // HexToUint32 parses Hex to uint32 without error.
func HexToUint32(hex string) uint32 { func HexToUint32(hex string) uint32 {
vv, _ := strconv.ParseUint(hex, 16, 32) vv, _ := strconv.ParseUint(hex, 16, 32)
return uint32(vv) return uint32(vv)
} }
// Parse to int32 without error // mustParseInt32 parses to int32 without error.
func mustParseInt32(val string) int32 { func mustParseInt32(val string) int32 {
vv, _ := strconv.ParseInt(val, 10, 32) vv, _ := strconv.ParseInt(val, 10, 32)
return int32(vv) return int32(vv)
} }
// Parse to uint64 without error // mustParseUint64 parses to uint64 without error.
func mustParseUint64(val string) uint64 { func mustParseUint64(val string) uint64 {
vv, _ := strconv.ParseInt(val, 10, 64) vv, _ := strconv.ParseInt(val, 10, 64)
return uint64(vv) return uint64(vv)
} }
// Parse to Float64 without error // mustParseFloat64 parses to Float64 without error.
func mustParseFloat64(val string) float64 { func mustParseFloat64(val string) float64 {
vv, _ := strconv.ParseFloat(val, 64) vv, _ := strconv.ParseFloat(val, 64)
return vv return vv
} }
// StringsHas checks the target string slice contains src or not // StringsHas checks the target string slice contains src or not.
func StringsHas(target []string, src string) bool { func StringsHas(target []string, src string) bool {
for _, t := range target { for _, t := range target {
if strings.TrimSpace(t) == src { if strings.TrimSpace(t) == src {
@ -258,7 +258,7 @@ func StringsHas(target []string, src string) bool {
return false return false
} }
// StringsContains checks the src in any string of the target string slice // StringsContains checks the src in any string of the target string slice.
func StringsContains(target []string, src string) bool { func StringsContains(target []string, src string) bool {
for _, t := range target { for _, t := range target {
if strings.Contains(t, src) { if strings.Contains(t, src) {

@ -110,7 +110,7 @@ func Virtualization() (string, string, error) {
return VirtualizationWithContext(context.Background()) return VirtualizationWithContext(context.Background())
} }
// required variables for concurrency safe virtualization caching // required variables for concurrency safe virtualization caching.
var ( var (
cachedVirtMap map[string]string cachedVirtMap map[string]string
cachedVirtMutex sync.RWMutex cachedVirtMutex sync.RWMutex
@ -281,7 +281,7 @@ func GetOSRelease() (platform string, version string, err error) {
return platform, version, nil return platform, version, nil
} }
// Remove quotes of the source string // trimQuotes removes quotes in the source string.
func trimQuotes(s string) string { func trimQuotes(s string) string {
if len(s) >= 2 { if len(s) >= 2 {
if s[0] == '"' && s[len(s)-1] == '"' { if s[0] == '"' && s[len(s)-1] == '"' {

Loading…
Cancel
Save