// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package a
import (
"fmt"
"os"
)
type A struct {
b int
}
func singleAssignment() {
if 1 == 1 {
}
panic("I should survive")
}
func noOtherStmtsInBlock() {
}
func partOfMultiAssignment() {
_, err := os.Open("file") // want `declared (and|but) not used`
panic(err)
}
func sideEffects(cBool chan bool, cInt chan int) {
<-c // want `declared (and|but) not used`
fmt.Sprint("") // want `declared (and|but) not used`
A{ // want `declared (and|but) not used`
b: func() int {
return 1
}(),
}
A{<-cInt} // want `declared (and|but) not used`
fInt() + <-cInt // want `declared (and|but) not used`
fBool() && <-cBool // want `declared (and|but) not used`
map[int]int{ // want `declared (and|but) not used`
fInt(): <-cInt,
}
[]int{<-cInt} // want `declared (and|but) not used`
func(s string) {}() // want `declared (and|but) not used`
}
func commentAbove() {
// v is a variable
}
func fBool() bool {
return true
}
func fInt() int {
return 1
}