Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.0.1-2020.1.5 / staticcheck / testdata / src / CheckWriterBufferModified / CheckWriterBufferModified.go
1 package pkg
2
3 type T1 struct{}
4 type T2 struct{}
5 type T3 struct{}
6 type T4 struct{}
7
8 func (T1) Write(b []byte) (int, error) {
9         b = append(b, '\n') // want `io\.Writer\.Write must not modify the provided buffer`
10         _ = b
11         return 0, nil
12 }
13
14 func (T2) Write(b []byte) (int, error) {
15         b[0] = 0 // want `io\.Writer\.Write must not modify the provided buffer`
16         return 0, nil
17 }
18
19 func (T3) Write(b []byte) string {
20         b[0] = 0
21         return ""
22 }
23
24 func (T4) Write(b []byte, r byte) (int, error) {
25         b[0] = r
26         return 0, nil
27 }