1
0
mirror of https://github.com/DNSCrypt/dnscrypt-proxy.git synced 2025-01-05 01:27:40 +01:00
dnscrypt-proxy/vendor/github.com/powerman/check/flags.go
William Elwood af0629856c Add unit tests for sources.go
Tests cover most of the cache and download related code paths and specify the expected result of various starting states and external failure modes.
Where the current code's behaviour doesn't match a test's expectations, the test is disabled and annotated with a TODO until it can be fixed.
Added dependency on `github.com/powerman/check` and ran `go mod vendor`.
2019-11-08 10:17:12 +01:00

25 lines
318 B
Go

package check
import (
"flag"
"sync"
)
type peekFlags struct {
sync.Once
conveyJSON bool
}
var flags peekFlags
func (p *peekFlags) detect() *peekFlags {
flags.Do(func() {
flag.Visit(func(f *flag.Flag) {
if f.Name == "convey-json" {
p.conveyJSON = f.Value.String() == "true"
}
})
})
return p
}