claudetool: remove Go file parsing enforcement
This had a bug, so it almost never triggered.
We've been fine without it, and sometimes
one legitimately wants a file that doesn't parse.
Rather than fix the bug, just delete.
diff --git a/claudetool/patch.go b/claudetool/patch.go
index b2b5db6..1f3231c 100644
--- a/claudetool/patch.go
+++ b/claudetool/patch.go
@@ -157,7 +157,6 @@
likelyGoFile := strings.HasSuffix(input.Path, ".go")
autogenerated := likelyGoFile && IsAutogeneratedGoFile(orig)
- parsed := likelyGoFile && parseGo(orig) != nil
origStr := string(orig)
// Process the patches "simultaneously", minimizing them along the way.
@@ -265,13 +264,6 @@
response := new(strings.Builder)
fmt.Fprintf(response, "- Applied all patches\n")
- if parsed {
- parseErr := parseGo(patched)
- if parseErr != nil {
- return llm.ErrorfToolOut("after applying all patches, the file no longer parses:\n%w", parseErr)
- }
- }
-
if autogenerated {
fmt.Fprintf(response, "- WARNING: %q appears to be autogenerated. Patches were applied anyway.\n", input.Path)
}
@@ -285,12 +277,6 @@
}
}
-func parseGo(buf []byte) error {
- fset := token.NewFileSet()
- _, err := parser.ParseFile(fset, "", buf, parser.SkipObjectResolution)
- return err
-}
-
// IsAutogeneratedGoFile reports whether a Go file has markers indicating it was autogenerated.
func IsAutogeneratedGoFile(buf []byte) bool {
for _, sig := range autogeneratedSignals {