Skip to content

Instantly share code, notes, and snippets.

@nodirt
Created June 17, 2016 07:12
Show Gist options
  • Save nodirt/714cbd66f2083bb38eb7cf7339711c67 to your computer and use it in GitHub Desktop.
Save nodirt/714cbd66f2083bb38eb7cf7339711c67 to your computer and use it in GitHub Desktop.

measure complexity of go code

cyclomatic complexity

number of linearly independent code paths https://en.wikipedia.org/wiki/Cyclomatic_complexity

layers of indirection

each call of of a func that does not have constant address is an indirection examples:

  • call of a func variable
  • call of an interface method

the more layers of indirection in the code the harder it may be to reason about

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment