{{ define "Head" -}} {{ .Name }} {{ end -}} {{ define "PkgVersion" }}{{ with .PkgVersion }}{{ . }} | {{ end }}{{ end }} {{ define "NavbarExtra" }} | Index{{ end -}} {{ define "Body" -}}

{{- /**/ -}} package {{ .Name -}}

{{ .Import | code }} {{ .Doc | doc 3 -}} {{ template "examples" (dict "Level" 3 "Examples" .Examples) -}}

Index

{{ if or .Constants .Variables .Functions .Types -}} {{- end }} {{- with .AllExamples -}}

Examples

{{- end -}} {{ with .Constants -}}

Constants

{{ range . }}{{ template "constOrVar" . }}{{ end -}} {{ end -}} {{ with .Variables -}}

Variables

{{ range . }}{{ template "constOrVar" . }}{{ end -}} {{ end -}} {{ with .Functions -}}

Functions

{{ range . -}} {{ if .Deprecated }}
{{ end -}}

func {{ .Name }} {{- template "deprecatedTag" . }}

{{- if .Deprecated }}
{{ end }} {{ .Decl | code }} {{ .Doc | doc 4 -}} {{ template "examples" (dict "Level" 4 "Examples" .Examples) -}} {{- if .Deprecated }}
{{ end -}} {{ end -}} {{ end -}} {{ with .Types -}}

Types

{{ range . -}} {{ if .Deprecated }}
{{ end -}}

type {{ .Name }} {{- template "deprecatedTag" . }}

{{- if .Deprecated }}
{{ end }} {{ .Decl | code }} {{ .Doc | doc 4 -}} {{ template "examples" (dict "Level" 4 "Examples" .Examples) -}} {{ range .Constants -}} {{ template "constOrVar" . -}} {{ end -}} {{ range .Variables -}} {{ template "constOrVar" . -}} {{ end -}} {{ range .Functions -}} {{ template "funcOrMethod" . -}} {{ end -}} {{ range .Methods -}} {{ template "funcOrMethod" . -}} {{ end -}} {{- if .Deprecated }}
{{ end -}} {{ end -}} {{ end -}} {{ with (filterSubpackages .Subpackages) -}} {{ template "subpackages.html" . -}} {{ end -}} {{ end -}} {{- define "constOrVar" -}} {{ .Decl | code }} {{ .Doc | doc 4 -}} {{- end -}} {{- define "funcOrMethod" -}} {{ $id := .Name -}} {{ with .RecvType }}{{ $id = printf "%s.%s" . $id }}{{ end -}} {{ if .Deprecated }}
{{ end -}}

func {{ with .Recv }}({{ . }}) {{end }}{{ .Name }} {{- template "deprecatedTag" . }}

{{- if .Deprecated }}
{{ end }} {{ .Decl | code }} {{ .Doc | doc 5 -}} {{ template "examples" (dict "Level" 5 "Examples" .Examples) -}} {{- if .Deprecated }}
{{ end -}} {{- end -}} {{- define "examples" -}} {{- $level := .Level -}} {{ range .Examples -}} {{- $id := printf "example-%s" .Parent.String -}} {{- if .Suffix }}{{ $id = printf "%s-%s" $id .Suffix }}{{ end -}}
Example {{- with .Suffix }} ({{ . }}) {{- end }} {{ .Doc | doc $level -}} {{ .Code | code }} {{ with .Output -}}

Output:

{{ . }}
{{- end -}}
{{ end -}} {{- end -}} {{- define "deprecatedTag" -}} {{ if .Deprecated }} deprecated{{ end -}} {{ end -}}