Skip to content

Commit ff7f595

Browse files
committed
[ga-format-pr] Run ./format_repo.sh to fix formatting
1 parent 6867d1d commit ff7f595

File tree

2 files changed

+41
-41
lines changed

2 files changed

+41
-41
lines changed

tools/update_all_plans.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,68 +9,68 @@ import (
99

1010
func main() {
1111
queryPlanFile := "/Users/amx/dolt_workspace/go-mysql-server/enginetest/queries/query_plans.go"
12-
12+
1313
for iteration := 1; iteration <= 20; iteration++ {
1414
fmt.Printf("Iteration %d...\n", iteration)
15-
15+
1616
// Run the test and capture output
1717
cmd := exec.Command("go", "test", "-v", "./enginetest", "-run", "TestQueryPlans", "-count=1")
1818
cmd.Dir = "/Users/amx/dolt_workspace/go-mysql-server"
1919
output, err := cmd.CombinedOutput()
20-
20+
2121
if err == nil {
2222
fmt.Println("All tests passed!")
2323
break
2424
}
25-
25+
2626
outputStr := string(output)
27-
27+
2828
// Read the file
2929
content, err := ioutil.ReadFile(queryPlanFile)
3030
if err != nil {
3131
fmt.Printf("Error reading file: %v\n", err)
3232
return
3333
}
34-
34+
3535
contentStr := string(content)
3636
updatedContent := contentStr
3737
updateCount := 0
38-
38+
3939
// Split output into sections by test failures
4040
sections := strings.Split(outputStr, "Not equal:")
41-
41+
4242
for _, section := range sections {
4343
if !strings.Contains(section, "expected:") || !strings.Contains(section, "actual") {
4444
continue
4545
}
46-
46+
4747
// Extract expected and actual values using a more robust approach
4848
expectedStart := strings.Index(section, "expected:")
4949
actualStart := strings.Index(section, "actual")
50-
50+
5151
if expectedStart == -1 || actualStart == -1 || actualStart <= expectedStart {
5252
continue
5353
}
54-
54+
5555
expectedSection := section[expectedStart:actualStart]
5656
actualSection := section[actualStart:]
57-
57+
5858
// Extract the quoted strings
5959
expected := extractQuotedString(expectedSection)
6060
actual := extractQuotedString(actualSection)
61-
61+
6262
if expected != "" && actual != "" {
6363
// Try to find and replace in the file
6464
quotedExpected := `"` + expected + `"`
6565
quotedActual := `"` + actual + `"`
66-
66+
6767
if strings.Contains(updatedContent, quotedExpected) {
6868
updatedContent = strings.Replace(updatedContent, quotedExpected, quotedActual, 1)
6969
updateCount++
7070
}
7171
}
7272
}
73-
73+
7474
if updateCount > 0 {
7575
// Write back to file
7676
err = ioutil.WriteFile(queryPlanFile, []byte(updatedContent), 0644)
@@ -84,7 +84,7 @@ func main() {
8484
break
8585
}
8686
}
87-
87+
8888
fmt.Println("Update complete!")
8989
}
9090

@@ -94,12 +94,12 @@ func extractQuotedString(section string) string {
9494
if start == -1 {
9595
return ""
9696
}
97-
97+
9898
// Find the matching end quote, handling escaped quotes
9999
content := section[start+1:]
100100
result := ""
101101
i := 0
102-
102+
103103
for i < len(content) {
104104
if content[i] == '\\' && i+1 < len(content) {
105105
// Escaped character
@@ -113,6 +113,6 @@ func extractQuotedString(section string) string {
113113
i++
114114
}
115115
}
116-
116+
117117
return result
118-
}
118+
}

tools/update_plans.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,36 @@ import (
99

1010
func main() {
1111
queryPlanFile := "/Users/amx/dolt_workspace/go-mysql-server/enginetest/queries/query_plans.go"
12-
12+
1313
for iteration := 1; iteration <= 10; iteration++ {
1414
fmt.Printf("Iteration %d...\n", iteration)
15-
15+
1616
// Run the test and capture output
1717
cmd := exec.Command("go", "test", "-v", "./enginetest", "-run", "TestQueryPlans")
1818
cmd.Dir = "/Users/amx/dolt_workspace/go-mysql-server"
1919
output, err := cmd.CombinedOutput()
20-
20+
2121
if err == nil {
2222
fmt.Println("All tests passed!")
2323
break
2424
}
25-
25+
2626
outputStr := string(output)
27-
27+
2828
// Find all test failures with expected vs actual - more robust approach
2929
lines := strings.Split(outputStr, "\n")
3030
updateCount := 0
31-
31+
3232
// Read the file
3333
content, err := ioutil.ReadFile(queryPlanFile)
3434
if err != nil {
3535
fmt.Printf("Error reading file: %v\n", err)
3636
return
3737
}
38-
38+
3939
contentStr := string(content)
4040
updatedContent := contentStr
41-
41+
4242
// Look for expected/actual pairs
4343
for i := 0; i < len(lines); i++ {
4444
line := strings.TrimSpace(lines[i])
@@ -48,12 +48,12 @@ func main() {
4848
if start == -1 {
4949
continue
5050
}
51-
51+
5252
// Find the end of the expected string, handling multi-line
5353
expected := ""
5454
currentLine := line[start+1:]
5555
lineIdx := i
56-
56+
5757
// Keep reading until we find the closing quote
5858
for lineIdx < len(lines) {
5959
if lineIdx == i {
@@ -74,31 +74,31 @@ func main() {
7474
}
7575
lineIdx++
7676
}
77-
77+
7878
// Look for the actual value
7979
actualStart := -1
80-
for j := lineIdx + 1; j < len(lines) && j < lineIdx + 10; j++ {
80+
for j := lineIdx + 1; j < len(lines) && j < lineIdx+10; j++ {
8181
if strings.Contains(lines[j], "actual") && strings.Contains(lines[j], `"`) {
8282
actualStart = j
8383
break
8484
}
8585
}
86-
86+
8787
if actualStart == -1 {
8888
continue
8989
}
90-
90+
9191
// Extract actual value
9292
actualLine := lines[actualStart]
9393
start = strings.Index(actualLine, `"`)
9494
if start == -1 {
9595
continue
9696
}
97-
97+
9898
actual := ""
9999
currentLine = actualLine[start+1:]
100100
lineIdx = actualStart
101-
101+
102102
// Keep reading until we find the closing quote
103103
for lineIdx < len(lines) {
104104
if lineIdx == actualStart {
@@ -119,17 +119,17 @@ func main() {
119119
}
120120
lineIdx++
121121
}
122-
122+
123123
// Try to find and replace in the file
124124
if expected != "" && actual != "" && strings.Contains(updatedContent, `"`+expected+`"`) {
125125
updatedContent = strings.ReplaceAll(updatedContent, `"`+expected+`"`, `"`+actual+`"`)
126126
updateCount++
127127
}
128128
}
129129
}
130-
130+
131131
fmt.Printf("Found %d failures to update\n", updateCount)
132-
132+
133133
if updateCount > 0 {
134134
// Write back to file
135135
err = ioutil.WriteFile(queryPlanFile, []byte(updatedContent), 0644)
@@ -143,6 +143,6 @@ func main() {
143143
break
144144
}
145145
}
146-
146+
147147
fmt.Println("Update complete!")
148-
}
148+
}

0 commit comments

Comments
 (0)