如何在golang模板中使用Continue和Break关键字?

For example:

{{range .Users}}
    {{if .IsAdmin}}
        {{/* How to use "break" or "continue"? */}}
    {{end}}
{{end}}

The documentation for "break" or "continue" in templates is not available in golang.org

They are not documented because they do not exist.

To make sure - check the tests for the text/template lexer: https://github.com/golang/go/blob/master/src/text/template/parse/lex_test.go

break and continue statements are part of text/template and html/template in Go 1.10 (in Beta at time of writing). From the release notes:

The new actions {{break}} and {{continue}} break out of the innermost {{range ...}} loop, like the corresponding Go statements.

Prior releases of Go (Before 1.10) do not support break or continue statements.

Looking at the beta documentation you can see the new itemContinue and itemBreak items in the lexer, the new nodes like ContinueNode in Parser to follow the code.

These were briefly added as a beta feature but have since been rolled back. I just tested with go1.12.5 and they are still not available.

Here's the github issue: https://github.com/golang/go/issues/20531

Here's the rollback: https://go-review.googlesource.com/c/go/+/92155/