24 lines
695 B
JavaScript
24 lines
695 B
JavaScript
import fs from "node:fs";
|
|||
|
|
import path from "node:path";
|
||
|
|
|
||
|
|
const root = path.resolve("apps/api/internal/httpapi");
|
||
|
|
const msgs = new Set();
|
||
|
|
function walk(dir) {
|
||
|
|
for (const ent of fs.readdirSync(dir, { withFileTypes: true })) {
|
||
|
|
const p = path.join(dir, ent.name);
|
||
|
|
if (ent.isDirectory()) walk(p);
|
||
|
|
else if (ent.name.endsWith(".go")) {
|
||
|
|
const s = fs.readFileSync(p, "utf8");
|
||
|
|
for (const m of s.matchAll(/Error\(w,\s*http\.Status\w+,\s*"([^"]+)"/g)) {
|
||
|
|
msgs.add(m[1]);
|
||
|
|
}
|
||
|
|
for (const m of s.matchAll(/CodedError\(w,\s*http\.Status\w+,\s*"[^"]+",\s*"([^"]+)"/g)) {
|
||
|
|
msgs.add(m[1]);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
walk(root);
|
||
|
|
console.log([...msgs].sort().join("\n"));
|
||
|
|
console.log("COUNT", msgs.size);
|