staticcheck/sa1023/testdata/go1.9/CheckWriterBufferModified/CheckWriterBufferModified.go
raw| 1 | package pkg |
| 2 | |
| 3 | type T5 struct{} |
| 4 | type T6 struct{} |
| 5 | |
| 6 | type AliasByte = byte |
| 7 | type AliasByteSlice = []byte |
| 8 | type AliasInt = int |
| 9 | type AliasError = error |
| 10 | |
| 11 | func (T5) Write(b []AliasByte) (int, error) { |
| 12 | b[0] = 0 //@ diag(`io.Writer.Write must not modify the provided buffer`) |
| 13 | return 0, nil |
| 14 | } |
| 15 | |
| 16 | func (T6) Write(b AliasByteSlice) (AliasInt, AliasError) { |
| 17 | b[0] = 0 //@ diag(`io.Writer.Write must not modify the provided buffer`) |
| 18 | return 0, nil |
| 19 | } |