提交 5d0724f4 编写于 作者: V Ville Skyttä

Comment convention fixes

上级 803cea9d
......@@ -94,7 +94,7 @@ func (i FakeInvoke) CommandWithContext(ctx context.Context, name string, arg ...
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) {
content, err := ioutil.ReadFile(filename)
......@@ -111,7 +111,7 @@ func ReadLines(filename string) ([]string, error) {
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 count determines the number of lines to read (starting from offset):
// n >= 0: at most n lines
......@@ -224,31 +224,31 @@ func ReadInts(filename string) ([]int64, error) {
return ret, nil
}
// Parse Hex to uint32 without error
// HexToUint32 parses Hex to uint32 without error.
func HexToUint32(hex string) uint32 {
vv, _ := strconv.ParseUint(hex, 16, 32)
return uint32(vv)
}
// Parse to int32 without error
// mustParseInt32 parses to int32 without error.
func mustParseInt32(val string) int32 {
vv, _ := strconv.ParseInt(val, 10, 32)
return int32(vv)
}
// Parse to uint64 without error
// mustParseUint64 parses to uint64 without error.
func mustParseUint64(val string) uint64 {
vv, _ := strconv.ParseInt(val, 10, 64)
return uint64(vv)
}
// Parse to Float64 without error
// mustParseFloat64 parses to Float64 without error.
func mustParseFloat64(val string) float64 {
vv, _ := strconv.ParseFloat(val, 64)
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 {
for _, t := range target {
if strings.TrimSpace(t) == src {
......@@ -258,7 +258,7 @@ func StringsHas(target []string, src string) bool {
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 {
for _, t := range target {
if strings.Contains(t, src) {
......@@ -308,7 +308,7 @@ func PathExists(filename string) bool {
return false
}
//GetEnv retrieves the environment variable key. If it does not exist it returns the default.
// GetEnv retrieves the environment variable key. If it does not exist it returns the default.
func GetEnv(key string, dfault string, combineWith ...string) string {
value := os.Getenv(key)
if value == "" {
......
......@@ -110,7 +110,7 @@ func Virtualization() (string, string, error) {
return VirtualizationWithContext(context.Background())
}
// required variables for concurrency safe virtualization caching
// required variables for concurrency safe virtualization caching.
var (
cachedVirtMap map[string]string
cachedVirtMutex sync.RWMutex
......@@ -281,7 +281,7 @@ func GetOSRelease() (platform string, version string, err error) {
return platform, version, nil
}
// Remove quotes of the source string
// trimQuotes removes quotes in the source string.
func trimQuotes(s string) string {
if len(s) >= 2 {
if s[0] == '"' && s[len(s)-1] == '"' {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册