diff --git a/directives_generate.go b/directives_generate.go index ccfd43e43c4..5192bf16e36 100644 --- a/directives_generate.go +++ b/directives_generate.go @@ -58,10 +58,22 @@ func genImports(file, pack string, mi map[string]string) { outs += "\n" } + coreDnsImports := "" + thirdPartyImports := "" + outs += "// Include all plugins.\n" for _, v := range mi { - outs += `_ "` + v + `"` + "\n" + if strings.HasPrefix(v, githubOrg) { + coreDnsImports += `_ "` + v + `"` + "\n" + } else { + thirdPartyImports += `_ "` + v + `"` + "\n" + } } + outs += coreDnsImports + if thirdPartyImports != "" { + outs += "\n" + thirdPartyImports + } + outs += ")\n" if err := formatAndWrite(file, outs); err != nil { @@ -107,7 +119,8 @@ func formatAndWrite(file string, data string) error { } const ( - pluginPath = "github.com/coredns/coredns/plugin/" + githubOrg = "github.com/coredns" + pluginPath = githubOrg + "/coredns/plugin/" pluginFile = "plugin.cfg" pluginFSPath = "plugin/" // Where the plugins are located on the file system header = "// generated by directives_generate.go; DO NOT EDIT\n\n"