Skip to content

Commit a7c02b5

Browse files
authored
Merge pull request #180 from warjiang/ci/golang-lint-whitespace
chore: format code about whitespace
2 parents ef734e5 + 0508282 commit a7c02b5

File tree

17 files changed

+1
-29
lines changed

17 files changed

+1
-29
lines changed

cmd/metrics-scraper/app/scrape/other.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ func saveToDBWithConnection(db *sql.DB, appName, podName string, data *db.Parsed
122122

123123
// Insert metrics and values
124124
for metricName, metricData := range data.Metrics {
125-
126125
result, err := tx.Exec(fmt.Sprintf(insertMainSQL, sanitizedPodName), metricName, metricData.Help, metricData.Type, data.CurrentTime)
127126
if err != nil {
128127
log.Printf("Error inserting data for metric %s: %v", metricName, err)
@@ -272,5 +271,4 @@ func parseMetricsToJSON(metricsOutput string) (*db.ParsedData, error) {
272271
Metrics: metrics,
273272
}
274273
return parsedData, nil
275-
276274
}

hack/verify-staticcheck.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ else
3232
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VER}
3333
fi
3434

35-
if golangci-lint run --enable-only goimports,gci; then
35+
if golangci-lint run --enable-only goimports,gci,whitespace; then
3636
echo 'Congratulations! All Go source files have passed staticcheck.'
3737
else
3838
echo # print one empty line, separate from warning messages.

pkg/client/init.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ func InitKubeConfig(options ...Option) {
155155
}
156156
kubernetesApiConfig = apiConfig
157157
}
158-
159158
}
160159

161160
func InClusterClient() kubeclient.Interface {

pkg/dataselect/dataselect_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ func TestSort(t *testing.T) {
152152
testCase.Info, testCase.SortQuery, order, testCase.ExpectedOrder)
153153
}
154154
}
155-
156155
}
157156

158157
func TestPagination(t *testing.T) {
@@ -220,5 +219,4 @@ func TestPagination(t *testing.T) {
220219
testCase.Info, testCase.PaginationQuery, order, testCase.ExpectedOrder)
221220
}
222221
}
223-
224222
}

pkg/resource/common/resourcechannels.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ type DeploymentListChannel struct {
183183
// that both must be read numReads times.
184184
func GetDeploymentListChannel(client client.Interface,
185185
nsQuery *NamespaceQuery, numReads int) DeploymentListChannel {
186-
187186
channel := DeploymentListChannel{
188187
List: make(chan *apps.DeploymentList, numReads),
189188
Error: make(chan error, numReads),
@@ -313,7 +312,6 @@ type ServiceListChannel struct {
313312
// must be read numReads times.
314313
func GetServiceListChannel(client client.Interface, nsQuery *NamespaceQuery,
315314
numReads int) ServiceListChannel {
316-
317315
channel := ServiceListChannel{
318316
List: make(chan *v1.ServiceList, numReads),
319317
Error: make(chan error, numReads),
@@ -384,7 +382,6 @@ func GetPodListChannel(client client.Interface,
384382
// GetPodListChannelWithOptions is GetPodListChannel plus listing options.
385383
func GetPodListChannelWithOptions(client client.Interface, nsQuery *NamespaceQuery,
386384
options metaV1.ListOptions, numReads int) PodListChannel {
387-
388385
channel := PodListChannel{
389386
List: make(chan *v1.PodList, numReads),
390387
Error: make(chan error, numReads),
@@ -462,7 +459,6 @@ type NodeListChannel struct {
462459
// GetNodeListChannel returns a pair of channels to a Node list and errors that both must be read
463460
// numReads times.
464461
func GetNodeListChannel(client client.Interface, numReads int) NodeListChannel {
465-
466462
channel := NodeListChannel{
467463
List: make(chan *v1.NodeList, numReads),
468464
Error: make(chan error, numReads),
@@ -528,7 +524,6 @@ type ConfigMapListChannel struct {
528524
// numReads times.
529525
func GetConfigMapListChannel(client client.Interface, nsQuery *NamespaceQuery,
530526
numReads int) ConfigMapListChannel {
531-
532527
channel := ConfigMapListChannel{
533528
List: make(chan *v1.ConfigMapList, numReads),
534529
Error: make(chan error, numReads),

pkg/resource/cronjob/detail.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ type CronJobDetail struct {
3838

3939
// GetCronJobDetail gets Cron Job details.
4040
func GetCronJobDetail(client k8sClient.Interface, namespace, name string) (*CronJobDetail, error) {
41-
4241
rawObject, err := client.BatchV1().CronJobs(namespace).Get(context.TODO(), name, metaV1.GetOptions{})
4342
if err != nil {
4443
return nil, err

pkg/resource/cronjob/events.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
// GetCronJobEvents gets events associated to cron job.
2828
func GetCronJobEvents(client client.Interface, dsQuery *dataselect.DataSelectQuery, namespace, name string) (
2929
*common.EventList, error) {
30-
3130
raw, err := event.GetEvents(client, namespace, name)
3231
if err != nil {
3332
return event.EmptyEventList, err

pkg/resource/cronjob/jobs.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ var emptyJobList = &job.JobList{
4848
// GetCronJobJobs returns list of jobs owned by cron job.
4949
func GetCronJobJobs(client client.Interface,
5050
dsQuery *dataselect.DataSelectQuery, namespace, name string, active bool) (*job.JobList, error) {
51-
5251
cronJob, err := client.BatchV1().CronJobs(namespace).Get(context.TODO(), name, meta.GetOptions{})
5352
if err != nil {
5453
return emptyJobList, err
@@ -90,7 +89,6 @@ func GetCronJobJobs(client client.Interface,
9089
// TriggerCronJob manually triggers a cron job and creates a new job.
9190
func TriggerCronJob(client client.Interface,
9291
namespace, name string) error {
93-
9492
cronJob, err := client.BatchV1().CronJobs(namespace).Get(context.TODO(), name, meta.GetOptions{})
9593

9694
if err != nil {

pkg/resource/cronjob/list.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ func GetCronJobList(client client.Interface, nsQuery *common.NamespaceQuery,
6969
// GetCronJobListFromChannels returns a list of all CronJobs in the cluster reading required resource
7070
// list once from the channels.
7171
func GetCronJobListFromChannels(channels *common.ResourceChannels, dsQuery *dataselect.DataSelectQuery) (*CronJobList, error) {
72-
7372
cronJobs := <-channels.CronJobList.List
7473
err := <-channels.CronJobList.Error
7574
nonCriticalErrors, criticalError := errors.ExtractErrors(err)
@@ -83,7 +82,6 @@ func GetCronJobListFromChannels(channels *common.ResourceChannels, dsQuery *data
8382
}
8483

8584
func toCronJobList(cronJobs []batch.CronJob, nonCriticalErrors []error, dsQuery *dataselect.DataSelectQuery) *CronJobList {
86-
8785
list := &CronJobList{
8886
Items: make([]CronJob, 0),
8987
ListMeta: types.ListMeta{TotalItems: len(cronJobs)},

pkg/resource/daemonset/common.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import (
3636
// label selector is targeting only 1 daemon set.
3737
func GetServicesForDSDeletion(client client.Interface, labelSelector labels.Selector,
3838
namespace string) ([]v1.Service, error) {
39-
4039
daemonSet, err := client.AppsV1().DaemonSets(namespace).List(context.TODO(), metaV1.ListOptions{
4140
LabelSelector: labelSelector.String(),
4241
FieldSelector: fields.Everything().String(),

pkg/resource/daemonset/detail.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ type DaemonSetDetail struct {
3939

4040
// GetDaemonSetDetail Returns detailed information about the given daemon set in the given namespace.
4141
func GetDaemonSetDetail(client k8sClient.Interface, namespace, name string) (*DaemonSetDetail, error) {
42-
4342
log.Printf("Getting details of %s daemon set in %s namespace", name, namespace)
4443
daemonSet, err := client.AppsV1().DaemonSets(namespace).Get(context.TODO(), name, metaV1.GetOptions{})
4544
if err != nil {

pkg/resource/daemonset/list.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ func GetDaemonSetList(client kubernetes.Interface, nsQuery *common.NamespaceQuer
6262
// GetDaemonSetListFromChannels returns a list of all Daemon Set in the cluster
6363
// reading required resource list once from the channels.
6464
func GetDaemonSetListFromChannels(channels *common.ResourceChannels, dsQuery *dataselect.DataSelectQuery) (*DaemonSetList, error) {
65-
6665
daemonSets := <-channels.DaemonSetList.List
6766
err := <-channels.DaemonSetList.Error
6867
nonCriticalErrors, criticalError := errors.ExtractErrors(err)
@@ -91,7 +90,6 @@ func GetDaemonSetListFromChannels(channels *common.ResourceChannels, dsQuery *da
9190

9291
func toDaemonSetList(daemonSets []apps.DaemonSet, pods []v1.Pod, events []v1.Event, nonCriticalErrors []error,
9392
dsQuery *dataselect.DataSelectQuery) *DaemonSetList {
94-
9593
daemonSetList := &DaemonSetList{
9694
DaemonSets: make([]DaemonSet, 0),
9795
ListMeta: types.ListMeta{TotalItems: len(daemonSets)},

pkg/resource/deployment/detail.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ type DeploymentDetail struct {
8484

8585
// GetDeploymentDetail returns model object of deployment and error, if any.
8686
func GetDeploymentDetail(client client.Interface, namespace string, deploymentName string) (*DeploymentDetail, error) {
87-
8887
log.Printf("Getting details of %s deployment in %s namespace", deploymentName, namespace)
8988

9089
deployment, err := client.AppsV1().Deployments(namespace).Get(context.TODO(), deploymentName, metaV1.GetOptions{})

pkg/resource/deployment/list.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ func GetDeploymentList(client client.Interface, nsQuery *common.NamespaceQuery,
7878
// GetDeploymentListFromChannels returns a list of all Deployments in the cluster
7979
// reading required resource list once from the channels.
8080
func GetDeploymentListFromChannels(channels *common.ResourceChannels, dsQuery *dataselect.DataSelectQuery) (*DeploymentList, error) {
81-
8281
deployments := <-channels.DeploymentList.List
8382
err := <-channels.DeploymentList.Error
8483
nonCriticalErrors, criticalError := errors.ExtractErrors(err)
@@ -115,7 +114,6 @@ func GetDeploymentListFromChannels(channels *common.ResourceChannels, dsQuery *d
115114

116115
func toDeploymentList(deployments []apps.Deployment, pods []v1.Pod, events []v1.Event, rs []apps.ReplicaSet,
117116
nonCriticalErrors []error, dsQuery *dataselect.DataSelectQuery) *DeploymentList {
118-
119117
deploymentList := &DeploymentList{
120118
Deployments: make([]Deployment, 0),
121119
ListMeta: types.ListMeta{TotalItems: len(deployments)},

pkg/resource/job/events.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
// GetJobEvents gets events associated to job.
2828
func GetJobEvents(client client.Interface, dsQuery *dataselect.DataSelectQuery, namespace, name string) (
2929
*common.EventList, error) {
30-
3130
jobEvents, err := event.GetEvents(client, namespace, name)
3231
if err != nil {
3332
return event.EmptyEventList, err

pkg/resource/job/list.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ func GetJobList(client client.Interface, nsQuery *common.NamespaceQuery,
102102

103103
// GetJobListFromChannels returns a list of all Jobs in the cluster reading required resource list once from the channels.
104104
func GetJobListFromChannels(channels *common.ResourceChannels, dsQuery *dataselect.DataSelectQuery) (*JobList, error) {
105-
106105
jobs := <-channels.JobList.List
107106
err := <-channels.JobList.Error
108107
nonCriticalErrors, criticalError := errors.ExtractErrors(err)
@@ -131,7 +130,6 @@ func GetJobListFromChannels(channels *common.ResourceChannels, dsQuery *datasele
131130

132131
func ToJobList(jobs []batch.Job, pods []v1.Pod, events []v1.Event, nonCriticalErrors []error,
133132
dsQuery *dataselect.DataSelectQuery) *JobList {
134-
135133
jobList := &JobList{
136134
Jobs: make([]Job, 0),
137135
ListMeta: types.ListMeta{TotalItems: len(jobs)},

pkg/resource/statefulset/list.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ func GetStatefulSetList(client kubernetes.Interface, nsQuery *common.NamespaceQu
6767
// GetStatefulSetListFromChannels returns a list of all Stateful Sets in the cluster reading
6868
// required resource list once from the channels.
6969
func GetStatefulSetListFromChannels(channels *common.ResourceChannels, dsQuery *dataselect.DataSelectQuery) (*StatefulSetList, error) {
70-
7170
statefulSets := <-channels.StatefulSetList.List
7271
err := <-channels.StatefulSetList.Error
7372
nonCriticalErrors, criticalError := errors.ExtractErrors(err)
@@ -96,7 +95,6 @@ func GetStatefulSetListFromChannels(channels *common.ResourceChannels, dsQuery *
9695

9796
func toStatefulSetList(statefulSets []apps.StatefulSet, pods []v1.Pod, events []v1.Event, nonCriticalErrors []error,
9897
dsQuery *dataselect.DataSelectQuery) *StatefulSetList {
99-
10098
statefulSetList := &StatefulSetList{
10199
StatefulSets: make([]StatefulSet, 0),
102100
ListMeta: types.ListMeta{TotalItems: len(statefulSets)},

0 commit comments

Comments
 (0)