Skip to content
Josh Bleecher Snyder edited this page Aug 17, 2023 · 5 revisions

This page is about Go-related Cursorless tips and quirks. It will eventually be subsumed by a Go docs page.

For the most part, Go is like any other Cursorless-supported language, and the first port of call is the main Cursorless documentation.

Scopes

Maps and lists

Cursorless considers any composite literal that contains any indexed element to be a map. That includes maps (map[string]int{"a": 2}), structs using field names (T{a: 2}), and arrays and structs with numeric indices ([256]bool{58: true}). It also includes {}.

Similarly, Cursorless considers any composite literal that contains any non-indexed element to be a list. That includes slices and arrays ([]int{2} and structs not using field names (T{2}). It also includes {}.

For the rationale, see: https://github.com/cursorless-dev/cursorless/blob/4588044dcc0d73d5507ff0cbf1dcd2ea988ffd6b/queries/go.scm#L39-L78

Funk and lambda

Funk refers to any func or method, generic or not, including both declared (func f() {}) and anonymous ones (f := func(){} or go func(){}). Lambda only refers to anonymous functions.

For a discussion, see: https://github.com/cursorless-dev/cursorless/pull/1756

Clone this wiki locally