All middleware equal (#535)
* all-middleware-equal
* Revert "all-middleware-equal"
This reverts commit ee77b2a981
.
* middleware: treat external and local the same
Make the middleware generation simpler and also specify the local
middleware, meaning that it can now be removed as well. Simplify
the code a bit and regen everything.
* remove lineNR, not used
This commit is contained in:
parent
bcd9c8b0fb
commit
ea38b642b8
4 changed files with 66 additions and 44 deletions
|
@ -25,22 +25,23 @@ func main() {
|
|||
scanner := bufio.NewScanner(file)
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
if !strings.HasPrefix(line, `//`) && !strings.HasPrefix(line, "#") {
|
||||
items := strings.Split(line, ":")
|
||||
if len(items) == 3 {
|
||||
if priority, err := strconv.Atoi(items[0]); err == nil {
|
||||
md[priority] = items[1]
|
||||
}
|
||||
if strings.HasPrefix(line, "#") {
|
||||
continue
|
||||
}
|
||||
|
||||
if items[2] != "" {
|
||||
if strings.Contains(items[2], "/") {
|
||||
mi[items[1]] = items[2]
|
||||
} else {
|
||||
mi[items[1]] = middlewarePath + items[2]
|
||||
}
|
||||
}
|
||||
items := strings.Split(line, ":")
|
||||
if len(items) != 3 {
|
||||
// ignore
|
||||
continue
|
||||
}
|
||||
priority, err := strconv.Atoi(items[0])
|
||||
fatalIfErr(err)
|
||||
|
||||
}
|
||||
md[priority] = items[1]
|
||||
mi[items[1]] = middlewarePath + items[2] // Default, unless overriden by 3rd arg
|
||||
|
||||
if strings.Contains(items[2], "/") { // External package has been given
|
||||
mi[items[1]] = items[2]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue