From 66f446325a24432db7498675f3faa43ce7fdadb6 Mon Sep 17 00:00:00 2001 From: "Guo, Fei" Date: Tue, 26 May 2020 16:49:00 -0700 Subject: [PATCH] Add go report and fix part of reported errors --- README.md | 9 +++++---- cmd/yurt-controller-manager/app/options/options.go | 2 +- cmd/yurthub/app/options/options.go | 4 ++-- pkg/yurthub/cachemanager/cache_agent_test.go | 3 +-- pkg/yurthub/storage/disk/storage_test.go | 6 ++---- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 0473ad0b567..68cb6c229d6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # OpenYurt [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) +[![Go Report Card](https://goreportcard.com/badge/github.com/alibaba/openyurt)](https://goreportcard.com/report/github.com/alibaba/openyurt) |![notification](img/bell-outline-badge.svg) What is NEW!| |------------------| @@ -11,10 +12,10 @@ In a nutshell, OpenYurt enables users to manage applications that run in the edg in the cloud infrastructure. OpenYurt is suitable for common edge computing use cases whose requirements include: -- minimizing the network traffic over long distances between the devices and the workloads. -- overcoming the network bandwidth or reliability limitations. -- processing data remotely to reduce latency. -- providing a better security model to handle sensitive data. +- Minimizing the network traffic over long distances between the devices and the workloads. +- Overcoming the network bandwidth or reliability limitations. +- Processing data remotely to reduce latency. +- Providing a better security model to handle sensitive data. OpenYurt has the following advantages in terms of compatibility and usability. - **Kubernetes native**. It provides full Kubernetes API compatibility. All Kubernetes workloads, services, diff --git a/cmd/yurt-controller-manager/app/options/options.go b/cmd/yurt-controller-manager/app/options/options.go index 090f4b9f17a..be17dcf4715 100644 --- a/cmd/yurt-controller-manager/app/options/options.go +++ b/cmd/yurt-controller-manager/app/options/options.go @@ -46,7 +46,7 @@ const ( YurtControllerManagerUserAgent = "yurt-controller-manager" ) -// KubeControllerManagerOptions is the main context object for the kube-controller manager. +// YurtControllerManagerOptions is the main context object for the kube-controller manager. type YurtControllerManagerOptions struct { Generic *GenericControllerManagerConfigurationOptions NodeLifecycleController *NodeLifecycleControllerOptions diff --git a/cmd/yurthub/app/options/options.go b/cmd/yurthub/app/options/options.go index aa1643f3980..259edfb071d 100644 --- a/cmd/yurthub/app/options/options.go +++ b/cmd/yurthub/app/options/options.go @@ -3,8 +3,8 @@ package options import ( "fmt" - "github.com/spf13/pflag" "github.com/alibaba/openyurt/pkg/yurthub/util" + "github.com/spf13/pflag" ) type YurtHubOptions struct { @@ -43,7 +43,7 @@ func ValidateOptions(options *YurtHubOptions) error { } if len(options.ServerAddr) == 0 { - return fmt.Errorf("server-address is emtpy") + return fmt.Errorf("server-address is empty") } if !util.IsSupportedLBMode(options.LBMode) { diff --git a/pkg/yurthub/cachemanager/cache_agent_test.go b/pkg/yurthub/cachemanager/cache_agent_test.go index 27ca8513555..0a6dc8bc65a 100644 --- a/pkg/yurthub/cachemanager/cache_agent_test.go +++ b/pkg/yurthub/cachemanager/cache_agent_test.go @@ -96,9 +96,8 @@ func compareAgents(gotAgents []string, expectedAgents []string) bool { return false } - notFound := true for _, agent := range gotAgents { - notFound = true + notFound := true for i := range expectedAgents { if expectedAgents[i] == agent { notFound = false diff --git a/pkg/yurthub/storage/disk/storage_test.go b/pkg/yurthub/storage/disk/storage_test.go index 1c7c41e0962..515d7d44f6d 100644 --- a/pkg/yurthub/storage/disk/storage_test.go +++ b/pkg/yurthub/storage/disk/storage_test.go @@ -277,9 +277,8 @@ func TestListKeys(t *testing.T) { t.Errorf("expect %d keys, but got %d keys", len(tempKeys), len(keys)) } - found := false for _, key := range tempKeys { - found = false + found := false for _, cachedKey := range keys { if key == cachedKey { found = true @@ -369,9 +368,8 @@ func TestList(t *testing.T) { t.Errorf("expect %d number of contents, but got %d number of contents", len(tempContents), len(contents)) } - found := false for _, content := range tempContents { - found = false + found := false for _, cachedContent := range contents { if content == string(cachedContent) { found = true