{% import ( "sort" "github.com/knq/chromedp/cmd/chromedp-gen/internal" ) %} // FileHeader is the file header template. {% func FileHeader(pkgName string, d *internal.Domain) %} {% if d != nil %}// Package {%s= d.PackageName() %} provides the Chrome Debugging Protocol // commands, types, and events for the Chrome {%s= d.String() %} domain. // {% if desc := d.Description; desc != "" %} {%s= formatComment(desc, "", "") %} //{% endif %} // Generated by the chromedp-gen command.{% end %} package {%s= pkgName %} // AUTOGENERATED. DO NOT EDIT. {% endfunc %} // FileImportTemplate is a general import template. {% func FileImportTemplate(m map[string]string) %}{% code var keys []string for k, _ := range m { keys = append(keys, k) } sort.Strings(keys) %} import ({% for _, k := range keys %}{% code v := m[k] %} {% if k != v %}{%s= v %} {% end %}"{%s= k %}"{% endfor %} ) {% endfunc %} // FileVarTemplate is a template for a single variable declaration. {% func FileVarTemplate(name, value, desc string) %} {%s= formatComment(desc, "", name+" ") %} var {%s= name %} = {%s= value %} {% endfunc %}