Merge pull request #59725 from wgliang/master.vet

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

fix some syntax related errors

**What this PR does / why we need it**:
fix some syntax related errors

**Special notes for your reviewer**:
None

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2018-02-27 01:45:01 -08:00 committed by GitHub
commit effa021db7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 9 deletions

View File

@ -309,7 +309,7 @@ values:
{ {
yamlBody := []byte(fmt.Sprintf(` yamlBody := []byte(fmt.Sprintf(`
values: values:
numVal: 3`, apiVersion, kind, uid, resourceVersion)) numVal: 3`))
result, err := rest.Patch(types.MergePatchType). result, err := rest.Patch(types.MergePatchType).
SetHeader("Accept", "application/yaml"). SetHeader("Accept", "application/yaml").
SetHeader("Content-Type", "application/yaml"). SetHeader("Content-Type", "application/yaml").

View File

@ -623,7 +623,7 @@ func TestFailGettingIPv4Routes(t *testing.T) {
errStrFrag := "no such file" errStrFrag := "no such file"
_, err := v4File.extract() _, err := v4File.extract()
if err == nil { if err == nil {
fmt.Errorf("Expected error trying to read non-existent v4 route file") t.Errorf("Expected error trying to read non-existent v4 route file")
} }
if !strings.Contains(err.Error(), errStrFrag) { if !strings.Contains(err.Error(), errStrFrag) {
t.Errorf("Unable to find %q in error string %q", errStrFrag, err.Error()) t.Errorf("Unable to find %q in error string %q", errStrFrag, err.Error())
@ -638,7 +638,7 @@ func TestFailGettingIPv6Routes(t *testing.T) {
errStrFrag := "no such file" errStrFrag := "no such file"
_, err := v6File.extract() _, err := v6File.extract()
if err == nil { if err == nil {
fmt.Errorf("Expected error trying to read non-existent v6 route file") t.Errorf("Expected error trying to read non-existent v6 route file")
} }
if !strings.Contains(err.Error(), errStrFrag) { if !strings.Contains(err.Error(), errStrFrag) {
t.Errorf("Unable to find %q in error string %q", errStrFrag, err.Error()) t.Errorf("Unable to find %q in error string %q", errStrFrag, err.Error())
@ -653,7 +653,7 @@ func TestGetAllDefaultRoutesFailNoV4RouteFile(t *testing.T) {
errStrFrag := "no such file" errStrFrag := "no such file"
_, err := getAllDefaultRoutes() _, err := getAllDefaultRoutes()
if err == nil { if err == nil {
fmt.Errorf("Expected error trying to read non-existent v4 route file") t.Errorf("Expected error trying to read non-existent v4 route file")
} }
if !strings.Contains(err.Error(), errStrFrag) { if !strings.Contains(err.Error(), errStrFrag) {
t.Errorf("Unable to find %q in error string %q", errStrFrag, err.Error()) t.Errorf("Unable to find %q in error string %q", errStrFrag, err.Error())

View File

@ -77,13 +77,13 @@ func testCache(cache cache, t *testing.T) {
// when empty, record is stored // when empty, record is stored
cache.set("foo", record1, time.Hour) cache.set("foo", record1, time.Hour)
if result, ok := cache.get("foo"); !ok || result != record1 { if result, ok := cache.get("foo"); !ok || result != record1 {
t.Errorf("Expected %#v, true, got %#v, %v", record1, ok) t.Errorf("Expected %#v, true, got %#v, %v", record1, result, ok)
} }
// newer record overrides // newer record overrides
cache.set("foo", record2, time.Hour) cache.set("foo", record2, time.Hour)
if result, ok := cache.get("foo"); !ok || result != record2 { if result, ok := cache.get("foo"); !ok || result != record2 {
t.Errorf("Expected %#v, true, got %#v, %v", record2, ok) t.Errorf("Expected %#v, true, got %#v, %v", record2, result, ok)
} }
// removing the current value removes // removing the current value removes

View File

@ -848,7 +848,7 @@ func TestAuditIDHttpHeader(t *testing.T) {
} }
} else { } else {
if resp.Header.Get("Audit-ID") != "" { if resp.Header.Get("Audit-ID") != "" {
t.Errorf("[%s] expected no Audit-ID http header returned, but got %p", test.desc, resp.Header.Get("Audit-ID")) t.Errorf("[%s] expected no Audit-ID http header returned, but got %s", test.desc, resp.Header.Get("Audit-ID"))
} }
} }
} }

View File

@ -14,9 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
// Package envelope transforms values for storage at rest using a Envelope provider
// +build !windows // +build !windows
// Package envelope transforms values for storage at rest using a Envelope provider
package envelope package envelope
import ( import (

View File

@ -206,7 +206,7 @@ func TestSetRotationDeadline(t *testing.T) {
t.Errorf("%d metrics were recorded, wanted %d", g.calls, 1) t.Errorf("%d metrics were recorded, wanted %d", g.calls, 1)
} }
if g.lastValue != float64(tc.notAfter.Unix()) { if g.lastValue != float64(tc.notAfter.Unix()) {
t.Errorf("%d value for metric was recorded, wanted %d", g.lastValue, tc.notAfter.Unix()) t.Errorf("%f value for metric was recorded, wanted %d", g.lastValue, tc.notAfter.Unix())
} }
}) })
} }