simplify slice expressions: s[:] => s (#1541)
Found using https://go-critic.github.io/overview#unslice-ref
This commit is contained in:
parent
df1e17c2f0
commit
3f27866f80
@ -978,7 +978,7 @@ func TestContextRenderProtoBuf(t *testing.T) {
|
|||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
assert.Equal(t, http.StatusCreated, w.Code)
|
assert.Equal(t, http.StatusCreated, w.Code)
|
||||||
assert.Equal(t, string(protoData[:]), w.Body.String())
|
assert.Equal(t, string(protoData), w.Body.String())
|
||||||
assert.Equal(t, "application/x-protobuf", w.HeaderMap.Get("Content-Type"))
|
assert.Equal(t, "application/x-protobuf", w.HeaderMap.Get("Content-Type"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
20
gin_test.go
20
gin_test.go
@ -88,7 +88,7 @@ func TestLoadHTMLGlob(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp, _ := ioutil.ReadAll(res.Body)
|
resp, _ := ioutil.ReadAll(res.Body)
|
||||||
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
|
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
|
||||||
|
|
||||||
td()
|
td()
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ func TestLoadHTMLGlob2(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp, _ := ioutil.ReadAll(res.Body)
|
resp, _ := ioutil.ReadAll(res.Body)
|
||||||
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
|
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
|
||||||
|
|
||||||
td()
|
td()
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ func TestLoadHTMLGlob3(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp, _ := ioutil.ReadAll(res.Body)
|
resp, _ := ioutil.ReadAll(res.Body)
|
||||||
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
|
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
|
||||||
|
|
||||||
td()
|
td()
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ func TestLoadHTMLGlobUsingTLS(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp, _ := ioutil.ReadAll(res.Body)
|
resp, _ := ioutil.ReadAll(res.Body)
|
||||||
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
|
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
|
||||||
|
|
||||||
td()
|
td()
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ func TestLoadHTMLGlobFromFuncMap(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp, _ := ioutil.ReadAll(res.Body)
|
resp, _ := ioutil.ReadAll(res.Body)
|
||||||
assert.Equal(t, "Date: 2017/07/01\n", string(resp[:]))
|
assert.Equal(t, "Date: 2017/07/01\n", string(resp))
|
||||||
|
|
||||||
td()
|
td()
|
||||||
}
|
}
|
||||||
@ -187,7 +187,7 @@ func TestLoadHTMLFiles(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp, _ := ioutil.ReadAll(res.Body)
|
resp, _ := ioutil.ReadAll(res.Body)
|
||||||
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
|
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
|
||||||
td()
|
td()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ func TestLoadHTMLFiles2(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp, _ := ioutil.ReadAll(res.Body)
|
resp, _ := ioutil.ReadAll(res.Body)
|
||||||
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
|
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
|
||||||
td()
|
td()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ func TestLoadHTMLFiles3(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp, _ := ioutil.ReadAll(res.Body)
|
resp, _ := ioutil.ReadAll(res.Body)
|
||||||
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
|
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
|
||||||
td()
|
td()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ func TestLoadHTMLFilesUsingTLS(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp, _ := ioutil.ReadAll(res.Body)
|
resp, _ := ioutil.ReadAll(res.Body)
|
||||||
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
|
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
|
||||||
td()
|
td()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ func TestLoadHTMLFilesFuncMap(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp, _ := ioutil.ReadAll(res.Body)
|
resp, _ := ioutil.ReadAll(res.Body)
|
||||||
assert.Equal(t, "Date: 2017/07/01\n", string(resp[:]))
|
assert.Equal(t, "Date: 2017/07/01\n", string(resp))
|
||||||
|
|
||||||
td()
|
td()
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ func TestRenderProtoBuf(t *testing.T) {
|
|||||||
err = (ProtoBuf{data}).Render(w)
|
err = (ProtoBuf{data}).Render(w)
|
||||||
|
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, string(protoData[:]), w.Body.String())
|
assert.Equal(t, string(protoData), w.Body.String())
|
||||||
assert.Equal(t, "application/x-protobuf", w.Header().Get("Content-Type"))
|
assert.Equal(t, "application/x-protobuf", w.Header().Get("Content-Type"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user