summaryrefslogtreecommitdiffstats
path: root/helpers/general.go
diff options
context:
space:
mode:
authorAnthony Fok <foka@debian.org>2014-12-26 08:07:03 -0700
committerAnthony Fok <foka@debian.org>2014-12-26 08:07:03 -0700
commitf5a3fb149fff3a44c2b3be8a0c46d02594d755c8 (patch)
tree6b97341a0706ad3e430a4be9386be83639dbc318 /helpers/general.go
parentfbf8bcacc464e9bfbc816fa6d097e6371662ce02 (diff)
Wrap comments helpers package to fit 80-column width
Add an initial space after `//` where appropriate. Minor copyediting.
Diffstat (limited to 'helpers/general.go')
-rw-r--r--helpers/general.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/helpers/general.go b/helpers/general.go
index e2f826f45..e409b997a 100644
--- a/helpers/general.go
+++ b/helpers/general.go
@@ -24,7 +24,7 @@ import (
"strings"
)
-//Filepath separator defined by os.Separator.
+// Filepath separator defined by os.Separator.
const FilePathSeparator = string(filepath.Separator)
func FindAvailablePort() (*net.TCPAddr, error) {
@@ -40,7 +40,8 @@ func FindAvailablePort() (*net.TCPAddr, error) {
return nil, err
}
-// InStringArray checks if a string is an element of a slice of strings and returns a boolean value.
+// InStringArray checks if a string is an element of a slice of strings
+// and returns a boolean value.
func InStringArray(arr []string, el string) bool {
for _, v := range arr {
if v == el {
@@ -64,31 +65,32 @@ func GuessType(in string) string {
return "unknown"
}
-//ReaderToBytes takes an io.Reader argument, reads from it and returns bytes.
+// ReaderToBytes takes an io.Reader argument, reads from it
+// and returns bytes.
func ReaderToBytes(lines io.Reader) []byte {
b := new(bytes.Buffer)
b.ReadFrom(lines)
return b.Bytes()
}
-//ReaderToString is the same as ReaderToBytes, but returns a string.
+// ReaderToString is the same as ReaderToBytes, but returns a string.
func ReaderToString(lines io.Reader) string {
b := new(bytes.Buffer)
b.ReadFrom(lines)
return b.String()
}
-//StringToReader does the opposite of ReaderToString.
+// StringToReader does the opposite of ReaderToString.
func StringToReader(in string) io.Reader {
return strings.NewReader(in)
}
-//BytesToReader does the opposite of ReaderToBytes.
+// BytesToReader does the opposite of ReaderToBytes.
func BytesToReader(in []byte) io.Reader {
return bytes.NewReader(in)
}
-// sliceToLower goes through the source slice and lowers all values.
+// SliceToLower goes through the source slice and lowers all values.
func SliceToLower(s []string) []string {
if s == nil {
return nil
@@ -102,7 +104,7 @@ func SliceToLower(s []string) []string {
return l
}
-//Md5String takes a string and returns a MD5 Hash of it.
+// Md5String takes a string and returns its MD5 hash.
func Md5String(f string) string {
h := md5.New()
h.Write([]byte(f))