mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 14:30:50 -08:00
* lisp/progmodes/go-ts-mode.el (go-ts-mode--indent-rules): Add indentation for type switch and select case blocks * test/lisp/progmodes/go-ts-mode-resources/indent.erts: New .erts file to test indentation of Go constructs and prevent regression of bug fixes. * test/lisp/progmodes/go-ts-mode-tests.el: New file with go-ts-mode tests.
47 lines
502 B
Text
47 lines
502 B
Text
Code:
|
|
(lambda ()
|
|
(go-ts-mode)
|
|
(indent-region (point-min) (point-max)))
|
|
|
|
Point-Char: |
|
|
|
|
Name: Basic
|
|
|
|
=-=
|
|
package main
|
|
|
|
func main() {
|
|
}
|
|
=-=-=
|
|
|
|
Name: Switch and Select
|
|
|
|
=-=
|
|
package main
|
|
|
|
func main() {
|
|
var x any
|
|
switch x {
|
|
case 1:
|
|
println("one")
|
|
default:
|
|
println("default case")
|
|
}
|
|
|
|
switch x.(type) {
|
|
case int:
|
|
println("integer")
|
|
default:
|
|
println("don't know the type")
|
|
}
|
|
|
|
var c chan int
|
|
select {
|
|
case x := <-c:
|
|
println(x)
|
|
default:
|
|
println("no communication")
|
|
}
|
|
}
|
|
|
|
=-=-=
|