Tooltitude for Go (GoLang) Features

CodeLens providers

  • Implementers count for interfaces and interface methods
  • Reference counts for functions, method, interfaces, fields, and interface methods
  • Run or debug main packages
  • Debug table driven tests
  • Implement interface

Inspections

  • Unused assignments/initializations
  • Unreachable code
  • Unhandled errors
  • Variable shadows
  • Deprecated symbols (only if vscode-go isn’t installed)

Postfix Completions

  • Completion for builtin types to invoke standard functions involving these types. As an example, you could write “abc”.ToLower and transform it to strings.ToLower(“abc)
  • .if for “if expr {}”; .ifn for “if !expr {}”; .ifnil for “if expr == nil {}”; .ifnnil for “if expr != nil {}”
  • .parens for “(expr)”
  • .print, .println, .panic, .len, .cap, .close, .new, .delete, .append or .make to call the corresponding standard library functions
  • .for, .switch, .return, and .defer to complete the corresponding statements
  • .for_range for automatic creation of iteration variables based on expression type
  • .&, .!, .*, .<- for &expr, !expr, *expr, <-expr
  • .var and .const for “var/const id = expr”
  • .=/:= for “id = expr” / “id := expr”

Code Actions

  • Handle error (with panic, return err, wrapped error)
  • Extract variable
  • Inline variable
  • Apply De Morgan Laws
  • Merge String Literals
  • Flip comma
  • Invert if conditions
  • Convert else { if { to else if {
  • Unwrap else code action (return in the if-true block)
  • Iterate over collection
  • Convert raw string <-> string literal
  • Convert separated decimal integer literal <-> non separated integer decimal literal (i.e. 1000000 <-> 1_000_000)
  • Add/remove octal prefix in octal literals (i.e. 0100 <-> 0o100)
  • Convert defer to “multiline” defer (via closure)
  • Add else to if
  • Add channel receive result to assignment
  • Remove redundant parenthesis
  • Convert interface {} to any
  • Convert assignment to unresovled variable to short var decl
  • Flip binary operation, i.e. a + b -> b + a and a > b to b < a
  • Convert x += a to x = x + a and back, as well as with other operations
  • Anonymous func single line to/from multiline func
  • Add var type
  • Rune literal to/from string literal
  • Var to/from short var declaration
  • Split field
  • Merge imports
  • Generate getter/setter
  • Generate stub interface for a type