Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ linters:
default: standard
enable:
- unparam
exclusions:
rules:
# The controller test files are kept close to the upstream Kubernetes
# StatefulSet controller tests, which freely ignore errors from in-memory
# fake stores and use helper signatures that trip unparam. Relax these
# checks for test files so the suite stays rebasable against upstream.
- path: _test\.go
linters:
- errcheck
- unparam
# QF1008 (remove embedded field from selector) is a stylistic quickfix;
# the upstream tests reference .ObjectMeta explicitly.
- path: _test\.go
linters:
- staticcheck
text: "QF1008:"

formatters:
enable:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ check-license:
ltag -t "./hack/license" --excludes "vendor contrib bin" --check -v

.PHONY: ci
ci: check-license lint build #unit-tests cover verify
ci: check-license lint build unit-tests #cover verify

.PHONY: qa
qa:
Expand Down
9 changes: 3 additions & 6 deletions pkg/cmds/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,18 @@ limitations under the License.
package cmds

import (
api "kubeops.dev/petset/apis/apps/v1"

"github.com/spf13/cobra"
v "gomodules.xyz/x/version"
genericapiserver "k8s.io/apiserver/pkg/server"
clientscheme "k8s.io/client-go/kubernetes/scheme"
)

func NewRootCmd() *cobra.Command {
// The PetSet/PlacementPolicy API types are registered with the client-go
// scheme via the petset controller package's init(), so there is no need to
// do it here in a PersistentPreRunE hook.
rootCmd := &cobra.Command{
Use: "petset",
DisableAutoGenTag: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
return api.AddToScheme(clientscheme.Scheme)
},
}
rootCmd.AddCommand(v.NewCmdVersion())

Expand Down
Loading
Loading