提交 ab77f912 编写于 作者: Z ZeHuaiWang 提交者: Kubernetes Prow Robot

Use golint (#4432)

* Reduce code duplication and fix typo

* fix apihandler.go

* fix

* fix

* use golint

if block ends with a return statement, so drop this else and outdent its block

* use golint

apihandler.go:1168:2: var sessionId should be sessionID

* fix a space

* fix

* fix

* use golint in backend/cert and backend/client

* use golint

* fix

* fix
上级 3ea3a76f
......@@ -17,9 +17,10 @@ package api
import "crypto/tls"
const (
// Certificate file names that will be generated by Dashboard
// DashboardCertName is the certificate file names that will be generated by Dashboard
DashboardCertName = "dashboard.crt"
DashboardKeyName = "dashboard.key"
// DashboardKeyName is the key file names that will be generated by Dashboard
DashboardKeyName = "dashboard.key"
)
// Manager is responsible for generating and storing self-signed certificates that can be used by Dashboard
......
......@@ -22,13 +22,13 @@ import (
certapi "github.com/kubernetes/dashboard/src/app/backend/cert/api"
)
// Implements cert/api/types.Manager interface. See Manager for more information.
// Manager is used to implement cert/api/types.Manager interface. See Manager for more information.
type Manager struct {
creator certapi.Creator
certDir string
}
// GenerateCertificates implements Manager interface. See Manager for more information.
// GetCertificates implements Manager interface. See Manager for more information.
func (self *Manager) GetCertificates() (tls.Certificate, error) {
if self.keyFileExists() && self.certFileExists() {
log.Println("Certificates already exist. Returning.")
......
......@@ -28,10 +28,10 @@ import (
)
const (
// Resource information that are used as csrf token storage. Can be accessible by multiple dashboard replicas.
// CsrfTokenSecretName is the resource information that are used as csrf token storage. Can be accessible by multiple dashboard replicas.
CsrfTokenSecretName = "kubernetes-dashboard-csrf"
// Name of the data var that holds the csrf token inside the secret.
// CsrfTokenSecretData is the name of the data var that holds the csrf token inside the secret.
CsrfTokenSecretData = "csrf"
)
......
......@@ -96,10 +96,9 @@ func (verber *resourceVerber) getResourceSpecFromKind(kind string, namespaceSet
if namespaceSet {
err = errors.NewInvalid(fmt.Sprintf("Set namespace for not-namespaced resource kind: %s", kind))
return
} else {
err = errors.NewInvalid(fmt.Sprintf("Set no namespace for namespaced resource kind: %s", kind))
return
}
err = errors.NewInvalid(fmt.Sprintf("Set no namespace for namespaced resource kind: %s", kind))
return
}
if client == nil {
......
......@@ -28,6 +28,7 @@ import (
type DeploymentCell apps.Deployment
// GetProperty is used to get property of the deployment
func (self DeploymentCell) GetProperty(name dataselect.PropertyName) dataselect.ComparableValue {
switch name {
case dataselect.NameProperty:
......
......@@ -31,6 +31,7 @@ type RollingUpdateStrategy struct {
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable"`
}
// StatusInfo is the status information of the deployment
type StatusInfo struct {
// Total number of desired replicas on the deployment
Replicas int32 `json:"replicas"`
......@@ -145,6 +146,7 @@ func GetDeploymentDetail(client client.Interface, namespace string, deploymentNa
}, nil
}
// GetStatusInfo is used to get the status information from the *apps.DeploymentStatus
func GetStatusInfo(deploymentStatus *apps.DeploymentStatus) StatusInfo {
return StatusInfo{
Replicas: deploymentStatus.Replicas,
......
......@@ -28,7 +28,7 @@ import (
client "k8s.io/client-go/kubernetes"
)
// DeploymentListComponent contains a list of Deployments in the cluster.
// DeploymentList contains a list of Deployments in the cluster.
type DeploymentList struct {
ListMeta api.ListMeta `json:"listMeta"`
CumulativeMetrics []metricapi.Metric `json:"cumulativeMetrics"`
......@@ -75,7 +75,7 @@ func GetDeploymentList(client client.Interface, nsQuery *common.NamespaceQuery,
return GetDeploymentListFromChannels(channels, dsQuery, metricClient)
}
// GetDeploymentList returns a list of all Deployments in the cluster
// GetDeploymentListFromChannels returns a list of all Deployments in the cluster
// reading required resource list once from the channels.
func GetDeploymentListFromChannels(channels *common.ResourceChannels, dsQuery *dataselect.DataSelectQuery,
metricClient metricapi.MetricClient) (*DeploymentList, error) {
......
......@@ -25,7 +25,7 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/resource/replicaset"
)
//GetDeploymentOldReplicaSets returns old replica sets targeting Deployment with given name
// GetDeploymentNewReplicaSet returns old replica sets targeting Deployment with given name
func GetDeploymentNewReplicaSet(client client.Interface, dsQuery *dataselect.DataSelectQuery,
namespace string, deploymentName string) (*replicaset.ReplicaSet, error) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册