Skip to content

Commit

Permalink
fix: building errors 1.15 and 1.16 (undefined: math.MaxInt)
Browse files Browse the repository at this point in the history
  • Loading branch information
horizon220222 committed Jul 9, 2023
1 parent 10dca8f commit 7aa92dd
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 23 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/build_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ for file in `find . -name go.mod`; do
fi
fi

# package sqlitecgo needs golang >= v1.17
if [ "sqlitecgo" = $(basename $dirpath) ]; then
if ! go version|grep -q "1.17"; then
echo "ignore otlphttp as go version: $(go version)"
continue 1
fi
fi

cd $dirpath
go mod tidy
go build ./...
Expand All @@ -62,4 +70,4 @@ for file in `find . -name go.mod`; do
fi

cd -
done
done
25 changes: 24 additions & 1 deletion contrib/drivers/sqlitecgo/go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
module github.com/gogf/gf/contrib/drivers/sqlite/cgo

go 1.16
go 1.17

require (
github.com/gogf/gf/v2 v2.4.4
github.com/mattn/go-sqlite3 v1.14.17
)

require (
github.com/BurntSushi/toml v1.1.0 // indirect
github.com/clbanning/mxj/v2 v2.5.5 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grokify/html-strip-tags-go v0.0.1 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/go-colorable v0.1.9 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
go.opentelemetry.io/otel v1.7.0 // indirect
go.opentelemetry.io/otel/sdk v1.7.0 // indirect
go.opentelemetry.io/otel/trace v1.7.0 // indirect
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)

replace github.com/gogf/gf/v2 => ../../../
2 changes: 1 addition & 1 deletion contrib/drivers/sqlitecgo/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Package sqlitecgo implements gdb.Driver, which supports operations for database SQLite.
//
// Note:
// 1. It needs manually import: _ "github.com/glebarez/go-sqlite"
// 1. It needs manually import: _ "https://github.com/mattn/go-sglite3"
// 2. It does not support Save/Replace features.
package sqlitecgo

Expand Down
40 changes: 20 additions & 20 deletions contrib/drivers/sqlitecgo/sqlite_core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,26 @@ func Test_New(t *testing.T) {
})
}

//func Test_New_Path_With_Colon(t *testing.T) {
// gtest.C(t, func(t *gtest.T) {
//
// dbFilePathWithColon := gfile.Join(dbDir, "test:1")
// if err := gfile.Mkdir(dbFilePathWithColon); err != nil {
// gtest.Error(err)
// }
// node := gdb.ConfigNode{
// Type: "sqlite",
// Link: fmt.Sprintf(`sqlite::@file(%s)`, gfile.Join(dbFilePathWithColon, "test.db")),
// Charset: "utf8",
// }
// newDb, err := gdb.New(node)
// t.AssertNil(err)
// value, err := newDb.GetValue(ctx, `select 1`)
// t.AssertNil(err)
// t.Assert(value, `1`)
// t.AssertNil(newDb.Close(ctx))
// })
//}
func Test_New_Path_With_Colon(t *testing.T) {
gtest.C(t, func(t *gtest.T) {

dbFilePathWithColon := gfile.Join(dbDir, "test:1")
if err := gfile.Mkdir(dbFilePathWithColon); err != nil {
gtest.Error(err)
}
node := gdb.ConfigNode{
Type: "sqlite",
Link: fmt.Sprintf(`sqlite::@file(%s)`, gfile.Join(dbFilePathWithColon, "test.db")),
Charset: "utf8",
}
newDb, err := gdb.New(node)
t.AssertNil(err)
value, err := newDb.GetValue(ctx, `select 1`)
t.AssertNil(err)
t.Assert(value, `1`)
t.AssertNil(newDb.Close(ctx))
})
}

func Test_DB_Ping(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
Expand Down

0 comments on commit 7aa92dd

Please sign in to comment.