CodeBench: korjaa Go-pipeline — tiedostoparseri + go mod tidy

- parseGeneratedFiles regex: lisätty .go ja .mod päätteet
- Markdown fence strippaus: lisätty go/gomod
- Dockerfile.go-test: go mod tidy ennen testejä (go.sum generoidaan)
- Testattu: 6/6 golden example ilman go.sum
This commit is contained in:
2026-04-14 19:27:19 +03:00
parent f3cd1347ab
commit 01364b7031
2 changed files with 3 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
FROM golang:1.23-alpine FROM golang:1.23-alpine
RUN apk add --no-cache gcc musl-dev RUN apk add --no-cache gcc musl-dev
WORKDIR /work WORKDIR /work
ENTRYPOINT ["sh", "-c", "cp -r /src/* . && go test -v -count=1 ./... 2>&1"] ENTRYPOINT ["sh", "-c", "cp -r /src/* . && go mod tidy 2>&1 && go test -v -count=1 ./... 2>&1"]

View File

@@ -225,11 +225,11 @@ function parseTestOutput(output) {
// === Tiedostoparseri LLM-vastauksesta === // === Tiedostoparseri LLM-vastauksesta ===
function parseGeneratedFiles(text) { function parseGeneratedFiles(text) {
const files = {}; const files = {};
const sections = text.split(/===\s*(\S+\.(?:py|toml|rs))\s*===/); const sections = text.split(/===\s*(\S+\.(?:py|toml|rs|go|mod))\s*===/);
for (let i = 1; i < sections.length - 1; i += 2) { for (let i = 1; i < sections.length - 1; i += 2) {
const name = sections[i]; const name = sections[i];
let content = sections[i + 1].trim(); let content = sections[i + 1].trim();
content = content.replace(/^```(?:python|toml|rust)?\s*\n?/m, '').replace(/\n?```\s*$/m, '').trim(); content = content.replace(/^```(?:python|toml|rust|go|gomod)?\s*\n?/m, '').replace(/\n?```\s*$/m, '').trim();
if (content) files[name] = content + '\n'; if (content) files[name] = content + '\n';
} }
return files; return files;