Skip to content

Commit

Permalink
fix golangci configs
Browse files Browse the repository at this point in the history
  • Loading branch information
bwagner5 committed Feb 27, 2022
1 parent 2396c10 commit 1526161
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
25 changes: 19 additions & 6 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ run:

timeout: 5m

build-tags:
- aws

skip-dirs:
- tools
- website
Expand All @@ -24,10 +21,26 @@ linters:
- tparallel
- unconvert
- unparam
- gocyclo
- govet
- gofmt
- goimports
disable:
- errcheck
- prealloc

linters-settings:
gci:
local-prefixes: github.com/aws/karpenter
linters-settings:
gci:
local-prefixes: github.com/aws/karpenter
gocyclo:
min-complexity: 11
govet:
check-shadowing: true
misspell:
locale: US
ignore-words: []
gofmt:
simplify: true

issues:
fix: true
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ test: ## Run tests
ginkgo -r

battletest: ## Run stronger tests
# Ensure all files have cyclo-complexity =< 10
gocyclo -over 11 ./pkg
# Run randomized, parallelized, racing, code coveraged, tests
ginkgo -r \
-cover -coverprofile=coverage.out -outputdir=. -coverpkg=./pkg/... \
Expand All @@ -38,8 +36,6 @@ battletest: ## Run stronger tests
verify: codegen ## Verify code. Includes dependencies, linting, formatting, etc
go mod tidy
go mod download
go vet ./...
go fmt ./...
golangci-lint run
@git diff --quiet ||\
{ echo "New file modification detected in the Git working tree. Please check in before commit.";\
Expand Down
3 changes: 2 additions & 1 deletion pkg/cloudprovider/aws/instancetypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ package aws
import (
"context"
"fmt"
"time"

"github.com/aws/karpenter/pkg/utils/injection"
"knative.dev/pkg/ptr"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/provisioning/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (p *Provisioner) Add(pod *v1.Pod) <-chan struct{} {
return p.batcher.Add(pod)
}

func (p *Provisioner) provision(ctx context.Context) (err error) {
func (p *Provisioner) provision(ctx context.Context) error {
// Batch pods
logging.FromContext(ctx).Infof("Waiting for unschedulable pods")
items, window := p.batcher.Wait()
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/provisioning/scheduling/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func NewScheduler(kubeClient client.Client) *Scheduler {
}
}

func (s *Scheduler) Solve(ctx context.Context, provisioner *v1alpha5.Provisioner, pods []*v1.Pod) (schedules []*Schedule, err error) {
func (s *Scheduler) Solve(ctx context.Context, provisioner *v1alpha5.Provisioner, pods []*v1.Pod) ([]*Schedule, error) {
defer metrics.Measure(schedulingDuration.WithLabelValues(injection.GetNamespacedName(ctx).Name))()
constraints := provisioner.Spec.Constraints.DeepCopy()
// Inject temporarily adds specific NodeSelectors to pods, which are then
Expand All @@ -74,7 +74,7 @@ func (s *Scheduler) Solve(ctx context.Context, provisioner *v1alpha5.Provisioner
return nil, fmt.Errorf("injecting topology, %w", err)
}
// Separate pods into schedules of isomorphic scheduling constraints.
schedules, err = s.getSchedules(ctx, constraints, pods)
schedules, err := s.getSchedules(ctx, constraints, pods)
if err != nil {
return nil, fmt.Errorf("getting schedules, %w", err)
}
Expand Down

0 comments on commit 1526161

Please sign in to comment.