mirror of
https://github.com/mgechev/revive.git
synced 2025-05-19 22:03:20 +02:00
50 lines
1.6 KiB
Go
50 lines
1.6 KiB
Go
package fixtures
|
|
|
|
type data struct {
|
|
num int
|
|
key *string
|
|
items map[string]bool
|
|
}
|
|
|
|
func (this data) vmethod() {
|
|
this.num = 8 // MATCH /suspicious assignment to a by-value method receiver/
|
|
*this.key = "v.key"
|
|
this.items = make(map[string]bool) // MATCH /suspicious assignment to a by-value method receiver/
|
|
this.items["vmethod"] = true
|
|
}
|
|
|
|
func (a A) Foo() *A {
|
|
a.whatever = true
|
|
return &a
|
|
}
|
|
|
|
func (a A) Clone() (*A, error) {
|
|
a.whatever = true
|
|
return &a, nil
|
|
}
|
|
|
|
// WithBin will set the specific bin path to the builder.
|
|
func (b JailerCommandBuilder) WithBin(bin string) JailerCommandBuilder {
|
|
b.bin = bin
|
|
return b
|
|
}
|
|
|
|
func (this data) incrementDecrement() {
|
|
this.num++ // MATCH /suspicious assignment to a by-value method receiver/
|
|
this.num-- // MATCH /suspicious assignment to a by-value method receiver/
|
|
other++
|
|
}
|
|
|
|
func (this data) assignmentOperators() {
|
|
this.num += 1 // MATCH /suspicious assignment to a by-value method receiver/
|
|
this.num -= 1 // MATCH /suspicious assignment to a by-value method receiver/
|
|
this.num *= 1 // MATCH /suspicious assignment to a by-value method receiver/
|
|
this.num /= 1 // MATCH /suspicious assignment to a by-value method receiver/
|
|
this.num %= 1 // MATCH /suspicious assignment to a by-value method receiver/
|
|
this.num &= 1 // MATCH /suspicious assignment to a by-value method receiver/
|
|
this.num ^= 1 // MATCH /suspicious assignment to a by-value method receiver/
|
|
this.num |= 1 // MATCH /suspicious assignment to a by-value method receiver/
|
|
this.num >>= 1 // MATCH /suspicious assignment to a by-value method receiver/
|
|
this.num <<= 1 // MATCH /suspicious assignment to a by-value method receiver/
|
|
}
|