# task_id: task-07-generate-template-main # category: generation # instruction: "In main.go, implement main() to execute a text/template that prints 'Hello World' along with a random integer, ensuring all necessary standard library packages are imported cleanly." # contexts: # - small # verification_constraint: "Verify your changes and ensure 'go build' succeeds with zero errors before concluding." # prompt_variants: # default: "In main.go, implement main() to execute a text/template that prints 'Hello World' along with a random integer, ensuring all necessary standard library packages are imported cleanly." # crypto_rand: "In main.go, implement main() to execute a text/template that prints 'Hello World' along with a random integer from crypto/rand, ensuring all necessary standard library packages are imported cleanly." # prefer_discover_semedit: "Before editing, inspect the complete available tool inventory, including deferred or lazy tools. If applicable semantic editing tools are callable, prefer them for source mutations. In main.go, implement main() to execute a text/template that prints 'Hello World' along with a random integer, ensuring all necessary standard library packages are imported cleanly." # oracle: # level_1_mutation_policy: # disallowed_files: # - "go.mod" # - "go.sum" # level_2_ast: # file: "main.go" # must_contain_symbols: # - "main" # must_contain_imports: # - "text/template" # level_3_build: # clean_compile: true # level_4_test: # pass_tests: true # # Golden CLI test verification: exec semedit replace-body --file main.go --symbol main --body 'tmpl := template.Must(template.New("greeting").Parse("Hello World! Random: {{.}}\n")); _ = tmpl.Execute(os.Stdout, rand.IntN(100))' exec semedit imports --file main.go --add text/template cmp main.go want/main.go exec go run main.go -- go.mod -- module example.com/templateapp go 1.23 -- main.go -- package main func main() { } -- want/main.go -- package main import ( "math/rand/v2" "os" "text/template" ) func main() { tmpl := template.Must(template.New("greeting").Parse("Hello World! Random: {{.}}\n")) _ = tmpl.Execute(os.Stdout, rand.IntN(100)) }