Skip to content

Commit b07f311

Browse files
authoredMay 2, 2019
Merge pull request kubernetes#76882 from SataQiu/fix-golint-controller-20190422
Fix golint failures of pkg/controller/certificates/approver, etc
2 parents 1626aa5 + 3c35e4e commit b07f311

File tree

10 files changed

+12
-16
lines changed

10 files changed

+12
-16
lines changed
 

‎hack/.golint_failures

-4
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ pkg/cloudprovider/providers/photon
5959
pkg/controller
6060
pkg/controller/apis/config/v1alpha1
6161
pkg/controller/certificates
62-
pkg/controller/certificates/approver
6362
pkg/controller/certificates/signer
6463
pkg/controller/certificates/signer/config/v1alpha1
6564
pkg/controller/cloud
@@ -272,13 +271,11 @@ pkg/registry/networking/rest
272271
pkg/registry/node/rest
273272
pkg/registry/policy/poddisruptionbudget/storage
274273
pkg/registry/policy/rest
275-
pkg/registry/rbac/clusterrole
276274
pkg/registry/rbac/clusterrole/policybased
277275
pkg/registry/rbac/clusterrolebinding
278276
pkg/registry/rbac/clusterrolebinding/policybased
279277
pkg/registry/rbac/reconciliation
280278
pkg/registry/rbac/rest
281-
pkg/registry/rbac/role
282279
pkg/registry/rbac/role/policybased
283280
pkg/registry/rbac/rolebinding
284281
pkg/registry/rbac/rolebinding/policybased
@@ -339,7 +336,6 @@ pkg/volume/scaleio
339336
pkg/volume/storageos
340337
pkg/volume/testing
341338
pkg/volume/util/fs
342-
pkg/volume/util/recyclerclient
343339
pkg/volume/util/volumepathhandler
344340
pkg/volume/vsphere_volume
345341
plugin/pkg/admission/antiaffinity

‎pkg/controller/certificates/approver/sarapprove.go

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ type sarApprover struct {
4242
recognizers []csrRecognizer
4343
}
4444

45+
// NewCSRApprovingController creates a new CSRApprovingController.
4546
func NewCSRApprovingController(client clientset.Interface, csrInformer certificatesinformers.CertificateSigningRequestInformer) *certificates.CertificateController {
4647
approver := &sarApprover{
4748
client: client,

‎pkg/registry/rbac/clusterrole/doc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// Package certificates provides Registry interface and its RESTStorage
17+
// Package clusterrole provides Registry interface and its RESTStorage
1818
// implementation for storing ClusterRole objects.
1919
package clusterrole // import "k8s.io/kubernetes/pkg/registry/rbac/clusterrole"

‎pkg/registry/rbac/clusterrole/registry.go

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ type AuthorizerAdapter struct {
6161
Registry Registry
6262
}
6363

64+
// GetClusterRole returns the corresponding ClusterRole by name
6465
func (a AuthorizerAdapter) GetClusterRole(name string) (*rbacv1.ClusterRole, error) {
6566
return a.Registry.GetClusterRole(genericapirequest.NewContext(), name, &metav1.GetOptions{})
6667
}

‎pkg/registry/rbac/clusterrole/strategy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type strategy struct {
3434
names.NameGenerator
3535
}
3636

37-
// strategy is the default logic that applies when creating and updating
37+
// Strategy is the default logic that applies when creating and updating
3838
// ClusterRole objects.
3939
var Strategy = strategy{legacyscheme.Scheme, names.SimpleNameGenerator}
4040

‎pkg/registry/rbac/role/doc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// Package certificates provides Registry interface and its RESTStorage
17+
// Package role provides Registry interface and its RESTStorage
1818
// implementation for storing Role objects.
1919
package role // import "k8s.io/kubernetes/pkg/registry/rbac/role"

‎pkg/registry/rbac/role/registry.go

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ type AuthorizerAdapter struct {
6161
Registry Registry
6262
}
6363

64+
// GetRole returns the corresponding Role by name in specified namespace
6465
func (a AuthorizerAdapter) GetRole(namespace, name string) (*rbacv1.Role, error) {
6566
return a.Registry.GetRole(genericapirequest.WithNamespace(genericapirequest.NewContext(), namespace), name, &metav1.GetOptions{})
6667
}

‎pkg/registry/rbac/role/strategy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type strategy struct {
3434
names.NameGenerator
3535
}
3636

37-
// strategy is the default logic that applies when creating and updating
37+
// Strategy is the default logic that applies when creating and updating
3838
// Role objects.
3939
var Strategy = strategy{legacyscheme.Scheme, names.SimpleNameGenerator}
4040

‎pkg/volume/util/recyclerclient/recycler_client.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"k8s.io/klog"
3030
)
3131

32+
// RecycleEventRecorder is a func that defines how to record RecycleEvent.
3233
type RecycleEventRecorder func(eventtype, message string)
3334

3435
// RecycleVolumeByWatchingPodUntilCompletion is intended for use with volume
@@ -127,9 +128,8 @@ func waitForPod(pod *v1.Pod, recyclerClient recyclerClient, podCh <-chan watch.E
127128
if pod.Status.Phase == v1.PodFailed {
128129
if pod.Status.Message != "" {
129130
return fmt.Errorf(pod.Status.Message)
130-
} else {
131-
return fmt.Errorf("pod failed, pod.Status.Message unknown.")
132131
}
132+
return fmt.Errorf("pod failed, pod.Status.Message unknown")
133133
}
134134

135135
case watch.Deleted:
@@ -238,9 +238,8 @@ func (c *realRecyclerClient) WatchPod(name, namespace string, stopChannel chan s
238238
case eventEvent, ok := <-eventWatch.ResultChan():
239239
if !ok {
240240
return
241-
} else {
242-
eventCh <- eventEvent
243241
}
242+
eventCh <- eventEvent
244243
}
245244
}
246245
}()
@@ -256,9 +255,8 @@ func (c *realRecyclerClient) WatchPod(name, namespace string, stopChannel chan s
256255
case podEvent, ok := <-podWatch.ResultChan():
257256
if !ok {
258257
return
259-
} else {
260-
eventCh <- podEvent
261258
}
259+
eventCh <- podEvent
262260
}
263261
}
264262
}()

‎pkg/volume/util/recyclerclient/recycler_client_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,8 @@ func (c *mockRecyclerClient) CreatePod(pod *v1.Pod) (*v1.Pod, error) {
210210
func (c *mockRecyclerClient) GetPod(name, namespace string) (*v1.Pod, error) {
211211
if c.pod != nil {
212212
return c.pod, nil
213-
} else {
214-
return nil, fmt.Errorf("pod does not exist")
215213
}
214+
return nil, fmt.Errorf("pod does not exist")
216215
}
217216

218217
func (c *mockRecyclerClient) DeletePod(name, namespace string) error {

0 commit comments

Comments
 (0)