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:
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.23-alpine
|
||||
RUN apk add --no-cache gcc musl-dev
|
||||
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"]
|
||||
|
||||
@@ -225,11 +225,11 @@ function parseTestOutput(output) {
|
||||
// === Tiedostoparseri LLM-vastauksesta ===
|
||||
function parseGeneratedFiles(text) {
|
||||
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) {
|
||||
const name = sections[i];
|
||||
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';
|
||||
}
|
||||
return files;
|
||||
|
||||
Reference in New Issue
Block a user