Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Reformat code with go fmt and check this on Travis CI #83

Merged
merged 1 commit into from
May 7, 2020
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ install:
script:
- ./hack/verify-codegen.sh
- go build ./...
- go fmt ./...
- golangci-lint run --config=linter_config.yaml ./...
# Here we run all tests in pkg and we have to use `-ignore`
# since goveralls uses `filepath.Match` to match ignore files
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.13
require (
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-openapi/spec v0.19.2
github.com/gogo/protobuf v1.1.1 // indirect
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
github.com/google/btree v1.0.0 // indirect
github.com/googleapis/gnostic v0.2.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller.v1/common/job_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
corelisters "k8s.io/client-go/listers/core/v1"

apiv1 "github.com/kubeflow/common/pkg/apis/common/v1"
"github.com/kubeflow/common/pkg/controller.v1/expectation"
log "github.com/sirupsen/logrus"
policyapi "k8s.io/api/policy/v1beta1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
Expand All @@ -22,7 +23,6 @@ import (
"k8s.io/client-go/tools/record"
"k8s.io/client-go/util/workqueue"
"volcano.sh/volcano/pkg/apis/scheduling/v1beta1"
"github.com/kubeflow/common/pkg/controller.v1/expectation"
volcanoclient "volcano.sh/volcano/pkg/client/clientset/versioned"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/controller.v1/common/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ import (
"github.com/kubeflow/common/pkg/controller.v1/control"
"github.com/kubeflow/common/pkg/controller.v1/expectation"
commonutil "github.com/kubeflow/common/pkg/util"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
log "github.com/sirupsen/logrus"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/controller.v1/common/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"testing"

apiv1 "github.com/kubeflow/common/pkg/apis/common/v1"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/stretchr/testify/assert"
)

func TestCalculateServiceSliceSize(t *testing.T) {
Expand Down
32 changes: 16 additions & 16 deletions pkg/controller.v1/control/controller_ref_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ func TestClaimPods(t *testing.T) {
controllerUID := "123"

type test struct {
name string
manager *PodControllerRefManager
pods []*v1.Pod
claimed []*v1.Pod
name string
manager *PodControllerRefManager
pods []*v1.Pod
claimed []*v1.Pod
}
var tests = []test{
func() test {
Expand All @@ -54,8 +54,8 @@ func TestClaimPods(t *testing.T) {
testJobLabelSelector,
testjobv1.SchemeGroupVersionKind,
func() error { return nil }),
pods: []*v1.Pod{testutilv1.NewBasePod("pod1", testJob, t), testPod},
claimed: []*v1.Pod{testutilv1.NewBasePod("pod1", testJob, t)},
pods: []*v1.Pod{testutilv1.NewBasePod("pod1", testJob, t), testPod},
claimed: []*v1.Pod{testutilv1.NewBasePod("pod1", testJob, t)},
}
}(),
func() test {
Expand All @@ -80,8 +80,8 @@ func TestClaimPods(t *testing.T) {
controllerLabelSelector,
testjobv1.SchemeGroupVersionKind,
func() error { return nil }),
pods: []*v1.Pod{testPod1, testPod2},
claimed: nil,
pods: []*v1.Pod{testPod1, testPod2},
claimed: nil,
}
}(),
func() test {
Expand All @@ -104,8 +104,8 @@ func TestClaimPods(t *testing.T) {
controllerLabelSelector,
testjobv1.SchemeGroupVersionKind,
func() error { return nil }),
pods: []*v1.Pod{testutilv1.NewBasePod("pod1", controller, t), testPod2},
claimed: []*v1.Pod{testutilv1.NewBasePod("pod1", controller, t)},
pods: []*v1.Pod{testutilv1.NewBasePod("pod1", controller, t), testPod2},
claimed: []*v1.Pod{testutilv1.NewBasePod("pod1", controller, t)},
}
}(),
func() test {
Expand All @@ -126,8 +126,8 @@ func TestClaimPods(t *testing.T) {
controllerLabelSelector,
testjobv1.SchemeGroupVersionKind,
func() error { return nil }),
pods: []*v1.Pod{testutilv1.NewBasePod("pod1", controller, t), testutilv1.NewBasePod("pod2", controller2, t)},
claimed: []*v1.Pod{testutilv1.NewBasePod("pod1", controller, t)},
pods: []*v1.Pod{testutilv1.NewBasePod("pod1", controller, t), testutilv1.NewBasePod("pod2", controller2, t)},
claimed: []*v1.Pod{testutilv1.NewBasePod("pod1", controller, t)},
}
}(),
func() test {
Expand All @@ -148,8 +148,8 @@ func TestClaimPods(t *testing.T) {
controllerLabelSelector,
testjobv1.SchemeGroupVersionKind,
func() error { return nil }),
pods: []*v1.Pod{testutilv1.NewBasePod("pod1", controller, t), testPod2},
claimed: []*v1.Pod{testutilv1.NewBasePod("pod1", controller, t)},
pods: []*v1.Pod{testutilv1.NewBasePod("pod1", controller, t), testPod2},
claimed: []*v1.Pod{testutilv1.NewBasePod("pod1", controller, t)},
}
}(),
func() test {
Expand All @@ -175,8 +175,8 @@ func TestClaimPods(t *testing.T) {
controllerLabelSelector,
testjobv1.SchemeGroupVersionKind,
func() error { return nil }),
pods: []*v1.Pod{testPod1, testPod2},
claimed: []*v1.Pod{testPod1},
pods: []*v1.Pod{testPod1, testPod2},
claimed: []*v1.Pod{testPod1},
}
}(),
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller.v1/control/pod_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,4 +274,4 @@ func (f *FakePodControl) Clear() {
f.Patches = [][]byte{}
f.CreateLimit = 0
f.CreateCallCount = 0
}
}
4 changes: 2 additions & 2 deletions pkg/controller.v1/control/service_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ import (
const (
// FailedCreateServiceReason is added in an event and in a job controller condition
// when a service for a job is failed to be created.
FailedCreateServiceReason = "FailedCreateService"
FailedCreateServiceReason = "FailedCreateService"
// SuccessfulCreateServiceReason is added in an event when a service for a job
// is successfully created.
SuccessfulCreateServiceReason = "SuccessfulCreateService"
// FailedDeleteServiceReason is added in an event and in a job condition
// when a service for a job is failed to be deleted.
FailedDeleteServiceReason = "FailedDeleteService"
FailedDeleteServiceReason = "FailedDeleteService"
// SuccessfulDeleteServiceReason is added in an event when a service for a job
// is successfully deleted.
SuccessfulDeleteServiceReason = "SuccessfulDeleteService"
Expand Down