Bypass mutation

Skip mutations when you already know certain paths or regions shouldn't be touched.

Tip: ignore as little as possible. If you ignore too much, mutation testing becomes less useful.

Exclude files with -x/--exclude

Skip files by regex. You can pass -x multiple times.

gooze run -x '^vendor/' -x '^mock_' ./...

The regex matches either the full path or the base filename.

Annotation skipping //gooze:ignore

Place //gooze:ignore to skip generating mutations for a file, a function/method, or a single line.

Optionally target specific mutagens: //gooze:ignore arithmetic,comparison.

//gooze:ignore arithmetic,comparison
package main

func main() {
  x := 1 + 2 //gooze:ignore numbers
  _ = x
}

Example: ignore the whole file

Put the directive near the top of the file.

//gooze:ignore
package main

// Whole file is ignored

Example: ignore one function

Put it on the function you want to ignore.

package main

//gooze:ignore comparison
func isOk(x int) bool {
  return x > 0
}

Example: ignore one line

Put it at the end of the line.

package main

func f() int {
  x := 1 + 2 //gooze:ignore numbers
  return x
}