Skip to content
Hands-on IT IT Drills

Appendix B: Final Exam

Goal: Prove that you can build a Go tool on your own, from the specification to a green check script, and that you can explain the concepts · Duration: 120 min practical + 20 min questions · Prerequisite: Day 15

Rules

  • Go 1.26, golangci-lint via ~/go-lab/bin/lint (Day 0); Ollama is not needed. Standard library only.
  • Allowed: go doc, Appendix A, go.dev. Not allowed: copying code from the chapters or reading the sample solution at the end of this appendix before the time is up.
  • The given tests and the check script are not modified.
  • Passed: Part 1 at least 70 of 100 points and Part 2 at least 18 of 25.

Part 1: Practical exam – secretscan

Build secretscan, a CLI that searches a folder for accidentally committed secrets – the scanner you would run before llm-commit (Day 15).

Specification

  • Module example.com/secretscan in ~/go-lab/pruefung-secretscan, package internal/scan, command cmd/secretscan.
  • Rules (name: pattern):
    • aws-access-key: AKIA plus 16 uppercase letters/digits, as a whole word
    • github-token: ghp_, gho_, ghu_, ghs_ or ghr_ plus 36 letters/digits, as a whole word
    • private-key: -----BEGIN … PRIVATE KEY----- (any uppercase letters and spaces in between)
    • api-key: sk- plus at least 20 characters from letters, digits, _ and -
  • scan.Line(line) returns the findings of one line ([]scan.Finding, only Rule and Match set), sorted by position. If the line contains secretscan:ignore, there are no findings.
  • scan.Mask(s) shows the first four characters, … and the length in characters: AKIA…(20); with at most four characters only …(3). Never print the whole secret.
  • scan.File(path) checks a file line by line (line numbers from 1). Files with a NUL byte in the first 512 bytes count as binary and return nothing.
  • scan.Dir(ctx, root, workers) searches root recursively with workers goroutines, skips the folders .git, node_modules and vendor as well as files over 1 MiB and non-files (symlinks …). Finding.File is relative to root with /; the result is sorted by file and line, the same for 1 and 8 workers. A canceled ctx returns context.Canceled, a missing folder os.ErrNotExist.
  • scan.Finding has the JSON names file, line, rule, match.
  • CLI: secretscan [-w N] [-json] ORDNER. Text: one line datei:zeile: regel maske (file:line: rule mask) per finding, N Treffer (N findings) last. JSON: an array (empty: [], never null). Exit 0 = nothing found, 1 = findings, 2 = wrong invocation or read error.

Given tests

mkdir -p ~/go-lab/pruefung-secretscan/{cmd/secretscan,internal/scan}
cd ~/go-lab/pruefung-secretscan
go mod init example.com/secretscan
printf 'version: "2"\nlinters:\n  exclusions:\n    presets: [%s]\n' \
  std-error-handling > .golangci.yml
cat > internal/scan/scan_test.go <<'EOF'
package scan

import (
    "context"
    "errors"
    "os"
    "path/filepath"
    "reflect"
    "strings"
    "testing"
)

// Lab values, assembled so that this test itself produces no finding.
var (
    awsKey = "AKIA" + "LABEXAMPLE000000"
    ghTok  = "ghp_" + strings.Repeat("a", 36)
    pemKey = "-----BEGIN " + "RSA PRIVATE KEY-----"
    skKey  = "sk-" + "lab-master-1234567890"
)

func TestLine(t *testing.T) {
    tests := []struct {
        line string
        want []string // Regeln
    }{
        {"aws_key = " + awsKey, []string{"aws-access-key"}},
        {"token: " + ghTok, []string{"github-token"}},
        {pemKey, []string{"private-key"}},
        {`OPENAI_API_KEY="` + skKey + `"`, []string{"api-key"}},
        {awsKey + " " + ghTok, []string{"aws-access-key", "github-token"}},
        {"aws_key = " + awsKey + " // secretscan:ignore", nil},
        {"AKIA zu kurz, ghp_kurz, sk-x", nil},
    }
    for _, tt := range tests {
        var got []string
        for _, f := range Line(tt.line) {
            got = append(got, f.Rule)
        }
        if !reflect.DeepEqual(got, tt.want) {
            t.Errorf("Line(%q) = %v, will %v", tt.line, got, tt.want)
        }
    }
}

func TestMask(t *testing.T) {
    if got := Mask(awsKey); got != "AKIA…(20)" {
        t.Errorf("Mask = %q", got)
    }
    if got := Mask("abc"); got != "…(3)" {
        t.Errorf("Mask(kurz) = %q", got)
    }
}

func write(t *testing.T, root, name, content string) {
    t.Helper()
    p := filepath.Join(root, name)
    if err := os.MkdirAll(filepath.Dir(p), 0o755); err != nil {
        t.Fatal(err)
    }
    if err := os.WriteFile(p, []byte(content), 0o644); err != nil {
        t.Fatal(err)
    }
}

func TestDir(t *testing.T) {
    root := t.TempDir()
    write(t, root, "app/config.yaml", "user: lab\ntoken: "+ghTok+"\n")
    write(t, root, "deploy/.env", "A=1\nAWS_KEY="+awsKey+"\nB=2\n")
    write(t, root, "keys/id_rsa", pemKey+"\nMIIE...\n")
    write(t, root, ".git/config", "token: "+ghTok+"\n") // übersprungen
    write(t, root, "bin/tool", "\x00\x01"+awsKey)       // binär
    write(t, root, "ok.txt", "nichts\n"+awsKey+" secretscan:ignore\n")
    for _, workers := range []int{1, 8} {
        got, err := Dir(context.Background(), root, workers)
        if err != nil {
            t.Fatal(err)
        }
        want := []Finding{
            {File: "app/config.yaml", Line: 2, Rule: "github-token",
                Match: "ghp_…(40)"},
            {File: "deploy/.env", Line: 2, Rule: "aws-access-key",
                Match: "AKIA…(20)"},
            {File: "keys/id_rsa", Line: 1, Rule: "private-key",
                Match: "----…(31)"},
        }
        if !reflect.DeepEqual(got, want) {
            t.Errorf("workers=%d:\n got %+v\nwant %+v", workers, got, want)
        }
    }
}

func TestDirFehler(t *testing.T) {
    _, err := Dir(context.Background(), "/gibt/es/nicht", 2)
    if !errors.Is(err, os.ErrNotExist) {
        t.Errorf("err = %v", err)
    }
    ctx, cancel := context.WithCancel(context.Background())
    cancel()
    if _, err := Dir(ctx, t.TempDir(), 2); !errors.Is(err, context.Canceled) {
        t.Errorf("err = %v, will context.Canceled", err)
    }
}
EOF
cat > cmd/secretscan/main_test.go <<'EOF'
package main

import (
    "bytes"
    "context"
    "encoding/json"
    "os"
    "path/filepath"
    "strings"
    "testing"
)

func TestRun(t *testing.T) {
    clean, dirty := t.TempDir(), t.TempDir()
    key := "AKIA" + "LABEXAMPLE000000" // Lab-Wert
    err := os.WriteFile(filepath.Join(dirty, "x.env"), []byte("K="+key+"\n"), 0o600)
    if err != nil {
        t.Fatal(err)
    }
    tests := []struct {
        name string
        args []string
        code int
        out  string
    }{
        {"sauber", []string{clean}, 0, "0 Treffer\n"},
        {"Treffer", []string{dirty}, 1,
            "x.env:1: aws-access-key AKIA…(20)\n1 Treffer\n"},
        {"ohne Ordner", nil, 2, ""},
        {"fehlt", []string{"/gibt/es/nicht"}, 2, ""},
        {"falsches Flag", []string{"-x", clean}, 2, ""},
    }
    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            var out, errOut bytes.Buffer
            code := run(context.Background(), tt.args, &out, &errOut)
            if code != tt.code || out.String() != tt.out {
                t.Errorf("Exit %d, Ausgabe %q; will %d, %q (stderr %q)",
                    code, out.String(), tt.code, tt.out, errOut.String())
            }
        })
    }
}

func TestRunJSON(t *testing.T) {
    dir := t.TempDir()
    pem := "-----BEGIN " + "EC PRIVATE KEY-----\n"
    err := os.WriteFile(filepath.Join(dir, "k.pem"), []byte(pem), 0o600)
    if err != nil {
        t.Fatal(err)
    }
    var out bytes.Buffer
    code := run(context.Background(), []string{"-json", dir}, &out, &out)
    if code != 1 {
        t.Fatalf("Exit %d", code)
    }
    var got []map[string]any
    if err := json.Unmarshal(out.Bytes(), &got); err != nil {
        t.Fatalf("kein JSON: %v\n%s", err, out.String())
    }
    if len(got) != 1 || got[0]["rule"] != "private-key" || got[0]["line"] != 1.0 ||
        strings.Contains(out.String(), "PRIVATE KEY") {
        t.Errorf("JSON = %s", out.String())
    }
}
EOF
date +%s > .start

The secrets in the tests are lab values and are assembled at runtime – so neither your own scanner nor your Git host’s scanner flags the test file.

Check script

cat > pruefe.sh <<'EOF'
#!/usr/bin/env bash
# pruefe.sh – grades the final exam (lab secrets, for testing only)
cd "$(dirname "$0")" || exit 2
pts=0
check() { # check PUNKTE NAME BEFEHL
  if eval "$3" >/dev/null 2>&1; then echo "✔ $1 P  $2"; pts=$((pts + $1))
  else echo "✘ 0 P  $2"; fi
}
fx=$(mktemp -d)
mkdir -p "$fx/app" "$fx/.git" "$fx/bin"
printf 'token: ghp_%s\n' "$(printf 'b%.0s' {1..36})" > "$fx/app/config.yaml"
printf 'A=1\nAWS_KEY=AKIA%s\n' LABEXAMPLE000000 > "$fx/app/.env"
printf 'K=AKIA%s # secretscan:ignore\n' LABEXAMPLE000000 > "$fx/ok.env"
printf 'token: ghp_%s\n' "$(printf 'c%.0s' {1..36})" > "$fx/.git/config"
printf '\0\1AKIA%s' LABEXAMPLE000000 > "$fx/bin/tool"
rm -f bin/secretscan; go build -o bin/secretscan ./cmd/secretscan 2>/dev/null
out=$(./bin/secretscan "$fx" 2>/dev/null); code=$?

check 10 "gofmt sauber" 'test -z "$(gofmt -l .)"'
check 10 "go vet + golangci-lint" "go vet ./... && ~/go-lab/bin/lint run ./..."
check 20 "Tests grün mit -race" "go test -race -count=1 ./..."
check 10 "Exit 1 bei Treffern" "test $code -eq 1"
check 10 "genau 2 Treffer" "tail -1 <<<\"\$out\" | grep -qx '2 Treffer'"
check 10 "Secrets maskiert" "test $code -eq 1 && ! grep -q LABEXAMPLE <<<\"\$out\""
check 10 ".git, Binär, ignore übersprungen" \
  "test $code -eq 1 && ! grep -qE '^(\.git|bin/|ok\.env)' <<<\"\$out\""
check 10 "JSON gültig" "./bin/secretscan -json '$fx' | jq -e 'length == 2'"
check 5 "Exit 0 ohne Treffer" "./bin/secretscan cmd"
check 5 "Exit 2 ohne Ordner" "./bin/secretscan; test \$? -eq 2"
rm -rf "$fx"
echo "Punkte: $pts von 100"
EOF
chmod +x pruefe.sh

Run it as often as you like; it builds the tool, creates a folder with lab secrets, checks and cleans up. After 120 minutes, the last run counts:

./pruefe.sh; echo "Zeit: $(( ($(date +%s) - $(cat .start)) / 60 )) min"

Expected before the first line of code (abbreviated):

✔ 10 P  gofmt sauber
✘ 0 P  go vet + golangci-lint
✘ 0 P  Tests grün mit -race
…
✘ 0 P  Exit 2 ohne Ordner
Punkte: 10 von 100

Points

Check Points Achieved
gofmt clean 10
go vet + golangci-lint 10
Tests green with -race 20
Exit 1 on findings 10
exactly 2 findings in the check folder 10
Secrets masked 10
.git, binary file, secretscan:ignore skipped 10
JSON valid 10
Exit 0 without findings 5
Exit 2 without a folder 5
Total 100

Part 2: Short questions

1 point each, pass mark 18 of 25. Answer in one or two sentences, without looking anything up.

  1. What is the difference between len("Grüße") and utf8.RuneCountInString("Grüße"), and what does range over a string yield?
  2. Why must you always assign the result of append again?
  3. What happens when reading from and writing to a nil map?
  4. When do you use a pointer receiver instead of a value receiver?
  5. How does a type satisfy an interface in Go, and what is var _ Parser = JSON{} for?
  6. What is the difference between %w and %v in fmt.Errorf?
  7. When do you use errors.Is, and when errors.As or errors.AsType?
  8. Why does a CLI’s logic belong in run(...) and not in main?
  9. What do the exit codes 0, 1 and 2 mean in this book?
  10. What does go test -race check, and why is it worth it even for tests without visible errors?
  11. What is a table-driven test, and what does t.Run give you?
  12. What are t.Helper() and t.Cleanup() for?
  13. What does a fuzz test do, and where do the failures it finds end up?
  14. Why is for b.Loop() better than for i := 0; i < b.N; i++?
  15. What is the difference between http.Client.Timeout and a context with a timeout?
  16. Why must resp.Body always be closed?
  17. For which HTTP responses does a retry make sense, and for which not?
  18. How does an http.Server shut down cleanly when Kubernetes stops the pod?
  19. Why may a worker pool write to results[i] without a lock, but not append to a shared slice?
  20. What do errgroup.WithContext and g.SetLimit(4) do?
  21. What happens in a select with a nil channel?
  22. What is the difference between go.mod and go.sum, and what does go mod tidy -diff do?
  23. How do you build a static Linux binary for arm64 with an embedded version on your Mac?
  24. How do you test code that talks to the Kubernetes API or an LLM, without a cluster and without a model?
  25. Why does llm-commit check the model’s answer with code instead of trusting the prompt?

Answer key

  1. len counts bytes (7), RuneCountInString characters (5); range yields the byte index and the rune.
  2. If the capacity is not enough, append creates a new array and returns a new slice header; the old one still points to the old array.
  3. Reading returns the zero value (and ok == false), writing causes a panic.
  4. When the method modifies the value, the type is large or contains a mutex; stay consistent within one type.
  5. Implicitly, as soon as all methods are present; the assignment makes the compiler check it, with no runtime cost.
  6. %w hooks the error into the chain (checkable with errors.Is/As), %v only takes over the text.
  7. errors.Is compares with a specific value (sentinel), errors.As/AsType looks for a type in the chain and hands it out with its fields.
  8. run gets the arguments, inputs and outputs as parameters and returns an exit code – that makes the whole tool testable without starting a process; main only calls os.Exit(run(...)).
  9. 0 = everything OK, 1 = errors or findings during the work, 2 = wrong invocation or unusable configuration.
  10. Concurrent accesses to the same memory without synchronization; data races often only show up under load and then silently produce wrong values.
  11. A slice of test cases with a loop; t.Run turns them into named subtests that run individually (-run Test/case) and fail individually.
  12. t.Helper() makes error messages point to the caller’s line, t.Cleanup() registers cleanup work that reliably runs after the test.
  13. It generates new inputs from seeds and checks properties; a finding is written to testdata/fuzz/<Name>/ and from then on runs with every go test.
  14. Setup before the loop isn’t counted, and the compiler may not optimize away the measured call (since Go 1.24).
  15. Client.Timeout limits a single request, the context the total budget including retries and waiting times – and it can be canceled from the outside.
  16. Otherwise the connection stays occupied and cannot be reused; in the long run you run out of file descriptors or connections.
  17. Sensible for 429, 5xx and network errors (with backoff, respecting Retry-After); not for other 4xx and not when the context has expired; only for idempotent requests.
  18. React to SIGTERM via signal.NotifyContext and call srv.Shutdown(ctx) with a deadline: no new connections, running requests may finish.
  19. Each index is written by exactly one goroutine and wg.Wait() ensures visibility; append modifies the shared slice header and is therefore a data race.
  20. The first error cancels the derived context for all the others, and Wait returns that error; SetLimit makes g.Go block as long as 4 goroutines are already running.
  21. A nil channel is never ready – the case is effectively switched off in the select.
  22. go.mod names the module, the Go version and the required versions, go.sum the checksums; tidy -diff only shows whether tidy would change anything (CI gate).
  23. GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=1.2.3" -o tool ./cmd/tool.
  24. Against fakes: fake.NewClientset for client-go, httptest.Server for HTTP APIs such as the LLM interface; the logic gets interfaces or functions injected.
  25. Models don’t reliably stick to formatting rules; code checks deterministically, and the error goes back to the model as feedback for another attempt.

Part 3: Self-assessment

Topic I can do it Done in the lab
Toolchain, module, -ldflags, linter (Day 0) [ ] [ ]
Slices, maps, runes, bufio (Day 1) [ ] [ ]
Structs, methods, interfaces, packages (Day 2) [ ] [ ]
Errors, wrapping, modules (Day 3) [ ] [ ]
Table tests, golden files, fuzzing, benchmarks (Day 4) [ ] [ ]
flag, cobra, config, os/exec (Day 5) [ ] [ ]
Files, JSON, YAML (Day 6) [ ] [ ]
HTTP client, context, retries (Day 7) [ ] [ ]
Goroutines, channels, worker pool, errgroup (Day 8) [ ] [ ]
HTTP server, middleware, slog, shutdown (Day 9) [ ] [ ]
database/sql with SQLite (Day 10) [ ] [ ]
client-go, informers, fake clientset (Day 11) [ ] [ ]
LLM via HTTP, streaming, tools, MCP (Day 12) [ ] [ ]
Generics, iterators, pprof (Day 13) [ ] [ ]
Cross-compiling, GoReleaser, CI (Day 14) [ ] [ ]
Tools from a specification under time pressure (Day 15) [ ] [ ]

Every row without two checkmarks: work through the chapter once more – rewrite the tool of the day without looking at the book.

Sample solution for Part 1

Read only once the 120 minutes are up.

cd ~/go-lab/pruefung-secretscan
cat > internal/scan/scan.go <<'EOF'
// Package scan searches text files for secrets.
package scan

import (
    "bufio"
    "bytes"
    "cmp"
    "context"
    "errors"
    "fmt"
    "io/fs"
    "os"
    "path/filepath"
    "regexp"
    "slices"
    "strings"
    "sync"
    "unicode/utf8"
)

// Finding is a hit. Match is masked – never the whole secret.
type Finding struct {
    File  string `json:"file"`
    Line  int    `json:"line"`
    Rule  string `json:"rule"`
    Match string `json:"match"`
}

type rule struct {
    name string
    re   *regexp.Regexp
}

var rules = []rule{
    {"aws-access-key", regexp.MustCompile(`\bAKIA[0-9A-Z]{16}\b`)},
    {"github-token", regexp.MustCompile(`\bgh[pousr]_[A-Za-z0-9]{36}\b`)},
    {"private-key", regexp.MustCompile(`-----BEGIN [A-Z ]*PRIVATE KEY-----`)},
    {"api-key", regexp.MustCompile(`\bsk-[A-Za-z0-9_-]{20,}`)},
}

const (
    ignoreMarker = "secretscan:ignore"
    maxSize      = 1 << 20 // größere Dateien sind selten Konfiguration
)

var skipDirs = []string{".git", "node_modules", "vendor"}

// Mask shows the first four characters and the length.
func Mask(s string) string {
    n := utf8.RuneCountInString(s)
    if n <= 4 {
        return fmt.Sprintf("…(%d)", n)
    }
    return fmt.Sprintf("%s…(%d)", string([]rune(s)[:4]), n)
}

// Line checks a line against all rules, findings sorted by position.
func Line(line string) []Finding {
    if strings.Contains(line, ignoreMarker) {
        return nil
    }
    type hit struct {
        pos int
        f   Finding
    }
    var hits []hit
    for _, r := range rules {
        for _, loc := range r.re.FindAllStringIndex(line, -1) {
            m := line[loc[0]:loc[1]]
            hits = append(hits, hit{loc[0], Finding{Rule: r.name, Match: Mask(m)}})
        }
    }
    slices.SortFunc(hits, func(a, b hit) int { return cmp.Compare(a.pos, b.pos) })
    var out []Finding
    for _, h := range hits {
        out = append(out, h.f)
    }
    return out
}

// File checks a file. Binary files (NUL byte near the start) return nothing.
func File(path string) ([]Finding, error) {
    data, err := os.ReadFile(path)
    if err != nil {
        return nil, err
    }
    if bytes.IndexByte(data[:min(len(data), 512)], 0) >= 0 {
        return nil, nil
    }
    var out []Finding
    sc := bufio.NewScanner(bytes.NewReader(data))
    sc.Buffer(nil, maxSize)
    for n := 1; sc.Scan(); n++ {
        for _, f := range Line(sc.Text()) {
            f.Line = n
            out = append(out, f)
        }
    }
    return out, sc.Err()
}

// Dir searches root with workers goroutines; file names relative to root.
func Dir(ctx context.Context, root string, workers int) ([]Finding, error) {
    var files []string
    err := filepath.WalkDir(root, func(p string, d fs.DirEntry, err error) error {
        if err != nil {
            return err
        }
        if err := ctx.Err(); err != nil {
            return err
        }
        if d.IsDir() && slices.Contains(skipDirs, d.Name()) {
            return filepath.SkipDir
        }
        if !d.Type().IsRegular() {
            return nil
        }
        // too large: skip (err is nil in that case)
        if info, err := d.Info(); err != nil || info.Size() > maxSize {
            return err
        }
        files = append(files, p)
        return nil
    })
    if err != nil {
        return nil, err
    }

    results := make([][]Finding, len(files))
    errs := make([]error, len(files))
    jobs := make(chan int)
    var wg sync.WaitGroup
    for range max(workers, 1) {
        wg.Go(func() {
            for i := range jobs {
                results[i], errs[i] = File(files[i])
            }
        })
    }
    for i := range files {
        jobs <- i
    }
    close(jobs)
    wg.Wait()
    if err := errors.Join(errs...); err != nil {
        return nil, err
    }

    var out []Finding
    for i, found := range results {
        rel, err := filepath.Rel(root, files[i])
        if err != nil {
            return nil, err
        }
        for _, f := range found {
            f.File = filepath.ToSlash(rel)
            out = append(out, f)
        }
    }
    slices.SortStableFunc(out, func(a, b Finding) int {
        return cmp.Or(cmp.Compare(a.File, b.File), cmp.Compare(a.Line, b.Line))
    })
    return out, nil
}
EOF
cat > cmd/secretscan/main.go <<'EOF'
// secretscan searches a folder for secrets: secretscan [-w 8] [-json] ORDNER
// Exit 0 = nothing found, 1 = findings, 2 = invocation or read error.
// Final exam of "Go hands-on".
package main

import (
    "context"
    "encoding/json"
    "flag"
    "fmt"
    "io"
    "os"
    "os/signal"
    "runtime"

    "example.com/secretscan/internal/scan"
)

func main() {
    ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
    defer stop()
    os.Exit(run(ctx, os.Args[1:], os.Stdout, os.Stderr))
}

func run(ctx context.Context, args []string, stdout, stderr io.Writer) int {
    fl := flag.NewFlagSet("secretscan", flag.ContinueOnError)
    fl.SetOutput(stderr)
    workers := fl.Int("w", runtime.NumCPU(), "parallele Leser")
    asJSON := fl.Bool("json", false, "JSON-Ausgabe")
    if err := fl.Parse(args); err != nil {
        return 2
    }
    if fl.NArg() != 1 {
        fmt.Fprintln(stderr, "Aufruf: secretscan [-w N] [-json] ORDNER")
        return 2
    }
    found, err := scan.Dir(ctx, fl.Arg(0), *workers)
    if err != nil {
        fmt.Fprintln(stderr, "secretscan:", err)
        return 2
    }
    if *asJSON {
        if found == nil {
            found = []scan.Finding{} // [] statt null
        }
        enc := json.NewEncoder(stdout)
        enc.SetEscapeHTML(false)
        _ = enc.Encode(found)
    } else {
        for _, f := range found {
            fmt.Fprintf(stdout, "%s:%d: %s %s\n", f.File, f.Line, f.Rule, f.Match)
        }
        fmt.Fprintf(stdout, "%d Treffer\n", len(found))
    }
    if len(found) > 0 {
        return 1
    }
    return 0
}
EOF
./pruefe.sh

Expected:

✔ 10 P  gofmt sauber
✔ 10 P  go vet + golangci-lint
✔ 20 P  Tests grün mit -race
✔ 10 P  Exit 1 bei Treffern
✔ 10 P  genau 2 Treffer
✔ 10 P  Secrets maskiert
✔ 10 P  .git, Binär, ignore übersprungen
✔ 10 P  JSON gültig
✔ 5 P  Exit 0 ohne Treffer
✔ 5 P  Exit 2 ohne Ordner
Punkte: 100 von 100

What the solution brings together: regex rules as a table (Days 2, 6), filepath.SkipDir for whole folders, the worker pool with its own index (Days 8, 15), errors.Join for read errors (Day 3), run(...) with exit codes (Day 6) and tests with t.TempDir (Day 4).

One last run over your own labs. Lab values such as lab-token-1234 (Day 5) match no rule; a real finding would be a reason to rotate the secret immediately:

./bin/secretscan ~/go-lab; echo "exit=$?"

Expected (depending on your labs):

0 Treffer
exit=0

Congratulations – you have completed your drills. From now on, the same rule applies as in every chapter: every new problem as a small tool with tests, run(...) and clean exit codes.