@@ -52,18 +52,21 @@ qQYZl8EZf4Jznaes/XFP0Yb+IhGXBoR9Ib+I
5252func tokenReviewHandler (w http.ResponseWriter , r * http.Request ) {
5353 if r .URL .Path != "/apis/authentication.k8s.io/v1/tokenreviews" {
5454 w .WriteHeader (404 )
55+
5556 return
5657 }
5758 body , err := ioutil .ReadAll (r .Body )
5859 if err != nil {
5960 w .WriteHeader (500 )
61+
6062 return
6163 }
62- defer r .Body .Close ()
64+ defer r .Body .Close () //nolint:errcheck
6365
6466 var tr authv1.TokenReview
6567 if err := json .Unmarshal (body , & tr ); err != nil {
6668 w .WriteHeader (500 )
69+
6770 return
6871 }
6972
@@ -84,7 +87,7 @@ func TestKubernetesAuth(t *testing.T) {
8487 defer srv .Close ()
8588
8689 ln , client := vaulttest .CreateTestVault (t , nil )
87- defer ln .Close ()
90+ defer ln .Close () //nolint:errcheck
8891
8992 ctx := context .Background ()
9093
@@ -115,7 +118,7 @@ func TestKubernetesAuth(t *testing.T) {
115118 if err != nil {
116119 t .Error (err )
117120 }
118- defer os .Remove (tmpfile .Name ())
121+ defer os .Remove (tmpfile .Name ()) //nolint:errcheck
119122
120123 if _ , err = tmpfile .Write ([]byte (jwtData )); err != nil {
121124 t .Error (err )
@@ -182,9 +185,9 @@ func TestKubernetesAuthFileError(t *testing.T) {
182185}
183186
184187func TestKubernetesAuthVaultError (t * testing.T ) {
185- srv := httptest .NewServer (http .HandlerFunc (( func (w http.ResponseWriter , r * http.Request ) {
188+ srv := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
186189 w .WriteHeader (404 )
187- })))
190+ }))
188191 defer srv .Close ()
189192
190193 client , err := api .NewClient (nil )
@@ -200,7 +203,7 @@ func TestKubernetesAuthVaultError(t *testing.T) {
200203 if err != nil {
201204 t .Error (err )
202205 }
203- defer os .Remove (tmpfile .Name ())
206+ defer os .Remove (tmpfile .Name ()) //nolint:errcheck
204207
205208 if _ , err = tmpfile .Write ([]byte (jwtData )); err != nil {
206209 t .Error (err )
0 commit comments