forked from v8platform/oneget
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.go
More file actions
37 lines (32 loc) · 745 Bytes
/
common.go
File metadata and controls
37 lines (32 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"strings"
"time"
)
func handleError(err error, msg string) {
if err != nil {
log.Fatalf("%s: %s", msg, err)
}
}
func Nicks(nicksRaw string) map[string]bool {
var nicksM map[string]bool
if len(nicksRaw) > 0 {
nicksS := strings.Split(nicksRaw, ",")
nicksM = make(map[string]bool, 0)
for _, nick := range nicksS {
nicksM[strings.Trim(nick, " ")] = true
//dr.nicks[projectHrefPrefix+strings.ToLower(k)] = v
}
}
return nicksM
}
func StartDate(startDateRaw string) time.Time {
if startDateRaw == "" {
return time.Unix(0, 0)
}
startTime, err := time.Parse("02.01.2006", startDateRaw)
if err != nil {
handleError(err, "Ошибка разбора даты начала")
}
return startTime
}