File: flags.go

package info (click to toggle)
golang-github-powerman-check 1.8.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 276 kB
  • sloc: sh: 15; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 358 bytes parent folder | download
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
package check

import (
	"flag"
	"sync"
)

type peekFlags struct {
	sync.Once
	conveyJSON bool
}

//nolint:gochecknoglobals // By design.
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
}