mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-06-06 23:49:33 +00:00
c28f7cb29f
Initial part of #435
46 lines
1 KiB
Go
46 lines
1 KiB
Go
package forbidigo
|
|
|
|
// Code generated by github.com/launchdarkly/go-options. DO NOT EDIT.
|
|
|
|
type ApplyOptionFunc func(c *config) error
|
|
|
|
func (f ApplyOptionFunc) apply(c *config) error {
|
|
return f(c)
|
|
}
|
|
|
|
func newConfig(options ...Option) (config, error) {
|
|
var c config
|
|
err := applyConfigOptions(&c, options...)
|
|
return c, err
|
|
}
|
|
|
|
func applyConfigOptions(c *config, options ...Option) error {
|
|
c.ExcludeGodocExamples = true
|
|
for _, o := range options {
|
|
if err := o.apply(c); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type Option interface {
|
|
apply(*config) error
|
|
}
|
|
|
|
// OptionExcludeGodocExamples don't check inside Godoc examples (see https://blog.golang.org/examples)
|
|
func OptionExcludeGodocExamples(o bool) ApplyOptionFunc {
|
|
return func(c *config) error {
|
|
c.ExcludeGodocExamples = o
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// OptionIgnorePermitDirectives don't check for `permit` directives(for example, in favor of `nolint`)
|
|
func OptionIgnorePermitDirectives(o bool) ApplyOptionFunc {
|
|
return func(c *config) error {
|
|
c.IgnorePermitDirectives = o
|
|
return nil
|
|
}
|
|
}
|