github.com/v2fly/tools@v0.100.0/internal/lsp/analysis/unusedparams/testdata/src/a/a.go (about) 1 // Copyright 2020 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package a 6 7 import ( 8 "bytes" 9 "fmt" 10 "net/http" 11 ) 12 13 type parent interface { 14 n(f bool) 15 } 16 17 type yuh struct { 18 a int 19 } 20 21 func (y *yuh) n(f bool) { 22 for i := 0; i < 10; i++ { 23 fmt.Println(i) 24 } 25 } 26 27 func a(i1 int, i2 int, i3 int) int { // want "potentially unused parameter: 'i2'" 28 i3 += i1 29 _ = func(z int) int { // want "potentially unused parameter: 'z'" 30 _ = 1 31 return 1 32 } 33 return i3 34 } 35 36 func b(c bytes.Buffer) { // want "potentially unused parameter: 'c'" 37 _ = 1 38 } 39 40 func z(h http.ResponseWriter, _ *http.Request) { // want "potentially unused parameter: 'h'" 41 fmt.Println("Before") 42 } 43 44 func l(h http.Handler) http.Handler { 45 return http.HandlerFunc(z) 46 } 47 48 func mult(a, b int) int { // want "potentially unused parameter: 'b'" 49 a += 1 50 return a 51 } 52 53 func y(a int) { 54 panic("yo") 55 }