Files
codeql/go/ql/test/query-tests/RedundantCode/ExprHasNoEffect/ExprHasNoEffect.go
2026-06-11 07:15:54 +02:00

16 lines
248 B
Go

package main
import "fmt"
type Timestamp int
func (t Timestamp) addDays(d int) Timestamp {
return Timestamp(int(t) + d*24*3600)
}
func test(t Timestamp) {
fmt.Printf("Before: %s\n", t)
t.addDays(7) // $ Alert
fmt.Printf("After: %s\n", t)
}