blob: 99e87d34145d9c8e32edc969935fef1d69262e19 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package templates
import (
"text/template"
)
const enumDeclTmplText = `
{{- define "EnumDecl" -}}
{{$enum := . -}}
type {{$enum.Name}} int32
const (
{{- range $value := $enum.Values -}}
{{$value.Name}} {{$enum.Name}} = {{$value.Value}}
{{end}}
)
{{- end -}}
`
func initEnumTemplates() {
template.Must(goFileTmpl.Parse(enumDeclTmplText))
}