Combine unnecessary multiple appends into one
x = append(x, 1)
x = append(x, 2)
will be replaced with
x = append(x, 1, 2)
Remove unnecessary negating of a boolean twice
!!x
will be replaced with
x
Remove unnecessary empty fallthroughs
switch x {
case 1:
fallthrough
case 2:
// do something
}
will be replaced with
switch x {
case 1, 2:
// do something
}
Fix empty string test
if len(s) == 0 {}
will be replaced with
if s == "" {}
Remove unnecessary true
expression in switch
switch true {}
will be replaced with
switch {}
Fix unnecessary index allocation
_ = strings.Index(string(x), y)
will be replaced with
_ = bytes.Index(x, []byte(y))
Fix suspiciously small untyped constant in time.Sleep
time.Sleep(1)
will be replaced with
time.Sleep(1 * time.Nanosecond)
Fix useless trapping of a signal
signal.Ignore(os.Signal(syscall.SIGKILL))
will be replaced with
signal.Ignore()
Fix nil context being passed to function
fn1(nil)
will be replaced with
fn1(context.Background())
Fix non-octal os.FileMode
os.OpenFile("", 0, 644)
will be replaced with
os.OpenFile("", 0, 0644)