Skip to content
Myr

simplify slice expressions: s[:] => s (#1541)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Found using https://go-critic.github.io/overview#unslice-ref

authored by Iskander (Alex) Sharipov · committed by Bo-Yi Wu · parent df1e17c · Browse files · 3 files+12 added−12 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+12 added−12 removed

  • other:+12 added−12 removed

3 files+12 added−12 removed

modified:render/render_test.go+1 added-1 removed
285 unmodified lines
286287 err = (ProtoBuf{data}).Render(w)288289 assert.NoError(t, err)290 assert.Equal(t, string(protoData[:]), w.Body.String())290 assert.Equal(t, string(protoData), w.Body.String())291 assert.Equal(t, "application/x-protobuf", w.Header().Get("Content-Type"))292}293294func TestRenderProtoBufFail(t *testing.T) {
192 unmodified lines
modified:context_test.go+1 added-1 removed
976 unmodified lines
977 protoData, err := proto.Marshal(data)978 assert.NoError(t, err)979980 assert.Equal(t, http.StatusCreated, w.Code)981 assert.Equal(t, string(protoData[:]), w.Body.String())981 assert.Equal(t, string(protoData), w.Body.String())982 assert.Equal(t, "application/x-protobuf", w.HeaderMap.Get("Content-Type"))983}984985func TestContextHeaders(t *testing.T) {
703 unmodified lines
modified:gin_test.go+10 added-10 removed
86 unmodified lines
87 fmt.Println(err)88 }8990 resp, _ := ioutil.ReadAll(res.Body)91 assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))91 assert.Equal(t, "<h1>Hello world</h1>", string(resp))9293 td()94}95
4 unmodified lines
100 fmt.Println(err)101 }102103 resp, _ := ioutil.ReadAll(res.Body)104 assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))104 assert.Equal(t, "<h1>Hello world</h1>", string(resp))105106 td()107}108
4 unmodified lines
113 fmt.Println(err)114 }115116 resp, _ := ioutil.ReadAll(res.Body)117 assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))117 assert.Equal(t, "<h1>Hello world</h1>", string(resp))118119 td()120}121
11 unmodified lines
133 fmt.Println(err)134 }135136 resp, _ := ioutil.ReadAll(res.Body)137 assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))137 assert.Equal(t, "<h1>Hello world</h1>", string(resp))138139 td()140}141
5 unmodified lines
147 fmt.Println(err)148 }149150 resp, _ := ioutil.ReadAll(res.Body)151 assert.Equal(t, "Date: 2017/07/01\n", string(resp[:]))151 assert.Equal(t, "Date: 2017/07/01\n", string(resp))152153 td()154}155
30 unmodified lines
186 fmt.Println(err)187 }188189 resp, _ := ioutil.ReadAll(res.Body)190 assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))190 assert.Equal(t, "<h1>Hello world</h1>", string(resp))191 td()192}193194func TestLoadHTMLFiles2(t *testing.T) {
3 unmodified lines
198 fmt.Println(err)199 }200201 resp, _ := ioutil.ReadAll(res.Body)202 assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))202 assert.Equal(t, "<h1>Hello world</h1>", string(resp))203 td()204}205206func TestLoadHTMLFiles3(t *testing.T) {
3 unmodified lines
210 fmt.Println(err)211 }212213 resp, _ := ioutil.ReadAll(res.Body)214 assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))214 assert.Equal(t, "<h1>Hello world</h1>", string(resp))215 td()216}217218func TestLoadHTMLFilesUsingTLS(t *testing.T) {
10 unmodified lines
229 fmt.Println(err)230 }231232 resp, _ := ioutil.ReadAll(res.Body)233 assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))233 assert.Equal(t, "<h1>Hello world</h1>", string(resp))234 td()235}236237func TestLoadHTMLFilesFuncMap(t *testing.T) {
4 unmodified lines
242 fmt.Println(err)243 }244245 resp, _ := ioutil.ReadAll(res.Body)246 assert.Equal(t, "Date: 2017/07/01\n", string(resp[:]))246 assert.Equal(t, "Date: 2017/07/01\n", string(resp))247248 td()249}250
207 unmodified lines