blob: edfe6629590818cd4c5da2434ae29302fa366f25 [file] [log] [blame]
{{/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/}}
{{define "Go.Prelude"}}
§{{$.Copyright}}§
package {{.Name}}¶
{{if File.Imports.Count}}
{{if eq (File.Imports.Count) 1}}
import {{range File.Imports}}{{range .}}"{{.Path}}"{{end}}{{end}}
{{else}}
import
{{range $g, $group := File.Imports}}
{{if len $group}}¶{{end}}
{{range $imp := $group}}
"{{$imp.Path}}"
{{end}}
{{end}}
«)
{{end}}
{{end}}
{{end}}
{{define "Go.Type"}}{{.Name}}{{end}}
{{define "Go.Type.Any"}}interface{}{{end}}
{{define "Go.Type.Pointer"}}*{{Call "Go.Type" .Type}}{{end}}
{{define "Go.Type.Array"}}[{{.Size}}]{{Call "Go.Type" .ValueType}}{{end}}
{{define "Go.Type.Slice"}}[]{{Call "Go.Type" .ValueType}}{{end}}
{{define "Go.Import.Primitive"}}{{File.ImportOwner .}}{{end}}
{{define "Go.Import.Struct"}}{{File.ImportOwner .}}{{end}}
{{define "Go.Import.Interface"}}{{File.ImportOwner .}}{{end}}
{{define "Go.Import.Pointer"}}{{Call "Go.Import" .Type}}{{end}}
{{define "Go.Import.Array"}}{{Call "Go.Import" .ValueType}}{{end}}
{{define "Go.Import.Slice"}}{{Call "Go.Import" .ValueType}}{{end}}
{{define "Go.Import"}}{{end}}
{{define "Go.ImportAny.Pointer"}}{{Call "Go.ImportAny" .Type}}{{end}}
{{define "Go.ImportAny.Array"}}{{Call "Go.ImportAny" .ValueType}}{{end}}
{{define "Go.ImportAny.Slice"}}{{Call "Go.ImportAny" .ValueType}}{{end}}
{{define "Go.ImportAny.Any"}}{{File.Import "android.googlesource.com/platform/tools/gpu/binary/any"}}{{end}}
{{define "Go.ImportAny"}}{{end}}