Skip to content

Commit

Permalink
Fixed panic: interface conversion: interface {} is int64, not []uint8
Browse files Browse the repository at this point in the history
```
panic: interface conversion: interface {} is int64, not []uint8 [recovered]
	panic: interface conversion: interface {} is int64, not []uint8

goroutine 35 [running]:
testing.tRunner.func1.2({0x6e4b00, 0xc00009e120})
	/opt/hostedtoolcache/go/1.22.0/x64/src/testing/testing.go:1631 +0x24a
testing.tRunner.func1()
	/opt/hostedtoolcache/go/1.22.0/x64/src/testing/testing.go:1634 +0x377
panic({0x6e4b00?, 0xc00009e120?})
	/opt/hostedtoolcache/go/1.22.0/x64/src/runtime/panic.go:770 +0x132
github.com/sue445/plant_erd/adapter/mysql.rowString(...)
	/home/runner/work/plant_erd/plant_erd/adapter/mysql/adapter.go:34
github.com/sue445/plant_erd/adapter/mysql.rowInt(0x6df820?, {0x730ebd?, 0x19?})
	/home/runner/work/plant_erd/plant_erd/adapter/mysql/adapter.go:38 +0xe5
github.com/sue445/plant_erd/adapter/mysql.(*Adapter).getIndexes(0xc0000501f8, {0x730365?, 0x8?})
	/home/runner/work/plant_erd/plant_erd/adapter/mysql/adapter.go:180 +0x337
github.com/sue445/plant_erd/adapter/mysql.(*Adapter).GetTable(0xc0000501f8, {0x730365, 0x8})
	/home/runner/work/plant_erd/plant_erd/adapter/mysql/adapter.go:97 +0x696
github.com/sue445/plant_erd/adapter/mysql.TestAdapter_GetTable.func1.4(0xc00012f1e0)
	/home/runner/work/plant_erd/plant_erd/adapter/mysql/adapter_test.go:236 +0x3e
testing.tRunner(0xc00012f1e0, 0xc000074fc0)
	/opt/hostedtoolcache/go/1.22.0/x64/src/testing/testing.go:1689 +0xfb
created by testing.(*T).Run in goroutine 11
	/opt/hostedtoolcache/go/1.22.0/x64/src/testing/testing.go:1742 +0x390
```

c.f. https://github.com/sue445/plant_erd/actions/runs/8224625813/job/22488671695?pr=246
  • Loading branch information
sue445 committed Mar 11, 2024
1 parent 46fc134 commit 180d3a4
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions adapter/mysql/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package mysql
import (
"fmt"
"sort"
"strconv"
"strings"

"github.com/go-sql-driver/mysql"
Expand Down Expand Up @@ -34,10 +33,8 @@ func rowString(row map[string]interface{}, columnName string) string {
return string(row[columnName].([]byte))
}

func rowInt(row map[string]interface{}, columnName string) int {
str := rowString(row, columnName)
num, _ := strconv.Atoi(str)
return num
func rowInt(row map[string]interface{}, columnName string) int64 {
return row[columnName].(int64)
}

// GetAllTableNames returns all table names in database
Expand Down

0 comments on commit 180d3a4

Please sign in to comment.