for i := 0; i < 8; i++ {
buf = (buf << 8) | uint64(bitMap[i])
}
这是语法糖么?
stayfoo
stay hungry stay foolish
之前看到一个开源库中的代码,自己看的就有些迷茫:
```go
// dayMatches returns true if the schedule's day-of-week and day-of-month
// restrictions are satisfied by the given time.
func dayMatches(s *SpecSchedule, t time.Time) bool {
var (
domMatch bool = 1<<uint(t.Day())&s.Dom > 0
dowMatch bool = 1<<uint(t.Weekday())&s.Dow > 0
)
if s.Dom&starBit > 0 || s.Dow&starBit > 0 {
return domMatch && dowMatch
}
return domMatch || dowMatch
}
```

#8
更多评论