Fix linter exemptions in golint

We were having issues with golint not properly reporting declaration of functions
without proper documentation (comments). This is due to a config with golangci.

See: https://github.com/golangci/golangci-lint/issues/456
This commit is contained in:
Sargun Dhillon
2020-12-04 21:17:23 -08:00
parent ca84620958
commit bbe4551940
12 changed files with 24 additions and 16 deletions

View File

@@ -14,3 +14,12 @@ linters:
- varcheck
- deadcode
- misspell
issues:
exclude-use-default: false
exclude:
# EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
# EXC0003 golint: False positive when tests are defined in package 'test'
- func name will be used as test\.Test.* by other packages, and that stutters; consider calling this

View File

@@ -19,7 +19,7 @@ import (
"go.opencensus.io/trace"
)
type TracingExporterOptions struct {
type TracingExporterOptions struct { // nolint: golint
Tags map[string]string
ServiceName string
}

View File

@@ -328,7 +328,7 @@ func (p *MockProvider) GetPods(ctx context.Context) ([]*v1.Pod, error) {
return pods, nil
}
func (p *MockProvider) ConfigureNode(ctx context.Context, n *v1.Node) {
func (p *MockProvider) ConfigureNode(ctx context.Context, n *v1.Node) { // nolint:golint
ctx, span := trace.StartSpan(ctx, "mock.ConfigureNode") // nolint:staticcheck,ineffassign
defer span.End()

View File

@@ -13,7 +13,7 @@ type Store struct {
ls map[string]InitFunc
}
func NewStore() *Store {
func NewStore() *Store { // nolint:golint
return &Store{
ls: make(map[string]InitFunc),
}
@@ -71,4 +71,4 @@ type InitConfig struct {
ResourceManager *manager.ResourceManager
}
type InitFunc func(InitConfig) (Provider, error)
type InitFunc func(InitConfig) (Provider, error) // nolint:golint

View File

@@ -7,7 +7,7 @@ const (
OperatingSystemWindows = "Windows"
)
type OperatingSystems map[string]bool
type OperatingSystems map[string]bool // nolint:golint
var (
// ValidOperatingSystems defines the group of operating systems
@@ -18,7 +18,7 @@ var (
}
)
func (o OperatingSystems) Names() []string {
func (o OperatingSystems) Names() []string { // nolint:golint
keys := make([]string, 0, len(o))
for k := range o {
keys = append(keys, k)

View File

@@ -5,7 +5,7 @@ import (
"fmt"
)
// InvalidInput is an error interface which denotes whether the opration failed due
// ErrInvalidInput is an error interface which denotes whether the opration failed due
// to a the resource not being found.
type ErrInvalidInput interface {
InvalidInput() bool

View File

@@ -5,7 +5,7 @@ import (
"fmt"
)
// NotFound is an error interface which denotes whether the opration failed due
// ErrNotFound is an error interface which denotes whether the opration failed due
// to a the resource not being found.
type ErrNotFound interface {
NotFound() bool

View File

@@ -31,6 +31,8 @@ type Subscription interface {
Value() Value
}
// Value contains the last set value from Set(). If the value is unset the version will be 0, and the value will be
// nil.
type Value struct {
Value interface{}
Version int64

View File

@@ -183,7 +183,7 @@ func (f *Framework) GetRunningPodsFromProvider(ctx context.Context) (*corev1.Pod
return result, err
}
// GetRunningPodsFromProvider gets the running pods from the provider of the virtual kubelet
// GetRunningPodsFromKubernetes gets the running pods from the provider of the virtual kubelet
func (f *Framework) GetRunningPodsFromKubernetes(ctx context.Context) (*corev1.PodList, error) {
result := &corev1.PodList{}

View File

@@ -49,9 +49,6 @@ type TermSize struct {
Height uint16
}
// HandleContainerExec makes an http handler func from a Provider which execs a command in a pod's container
// Note that this handler currently depends on gorrilla/mux to get url parts as variables.
// TODO(@cpuguy83): don't force gorilla/mux on consumers of this function
// ContainerExecHandlerConfig is used to pass options to options to the container exec handler.
type ContainerExecHandlerConfig struct {
// StreamIdleTimeout is the maximum time a streaming connection
@@ -72,7 +69,7 @@ func WithExecStreamIdleTimeout(dur time.Duration) ContainerExecHandlerOption {
}
}
// WithExecStreamIdleTimeout sets the idle timeout for a container exec stream
// WithExecStreamCreationTimeout sets the creation timeout for a container exec stream
func WithExecStreamCreationTimeout(dur time.Duration) ContainerExecHandlerOption {
return func(cfg *ContainerExecHandlerConfig) {
cfg.StreamCreationTimeout = dur

View File

@@ -24,9 +24,9 @@ import (
"k8s.io/apimachinery/pkg/runtime/serializer"
)
type PodListerFunc func(context.Context) ([]*v1.Pod, error)
type PodListerFunc func(context.Context) ([]*v1.Pod, error) // nolint:golint
func HandleRunningPods(getPods PodListerFunc) http.HandlerFunc {
func HandleRunningPods(getPods PodListerFunc) http.HandlerFunc { // nolint:golint
if getPods == nil {
return NotImplemented
}

View File

@@ -33,7 +33,7 @@ type ServeMux interface {
Handle(path string, h http.Handler)
}
type PodHandlerConfig struct {
type PodHandlerConfig struct { // nolint:golint
RunInContainer ContainerExecHandlerFunc
GetContainerLogs ContainerLogsHandlerFunc
// GetPods is meant to enumerate the pods that the provider knows about