Skip to content

Commit

Permalink
Merge pull request #121 from gcs278/OCPBUGS-34619-TestImportOrdering
Browse files Browse the repository at this point in the history
OCPBUGS-34619: UPSTREAM: 6692: openshift: Fix OCPBUGS-34619
  • Loading branch information
openshift-merge-bot[bot] authored Jun 10, 2024
2 parents 4a14f34 + c87f74b commit f80a0b3
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions directives_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit f80a0b3

Please sign in to comment.