Skip to content

Commit

Permalink
update imports / goreleaser wip (#69)
Browse files Browse the repository at this point in the history
* update imports / goreleaser wip

* fix tests

* remove non linux-x86_64 builds

---------

Co-authored-by: BuckarooBanzay <[email protected]>
  • Loading branch information
BuckarooBanzay and BuckarooBanzay authored Aug 14, 2023
1 parent 7f27d14 commit 579df82
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 206 deletions.
7 changes: 2 additions & 5 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ before:
builds:
- main: ./cmd/mtdb
env:
- CGO_ENABLED=0
- CGO_ENABLED=1
targets:
- linux_amd64
- linux_arm_6
- windows_amd64
- darwin_arm64
ldflags:
- -s -w
- -s -w -extldflags=-static
changelog:
sort: asc
filters:
Expand Down
4 changes: 2 additions & 2 deletions auth/auth_migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"database/sql"
"testing"

_ "modernc.org/sqlite"
_ "github.com/mattn/go-sqlite3"

"github.com/minetest-go/mtdb/auth"
"github.com/minetest-go/mtdb/types"
Expand All @@ -13,7 +13,7 @@ import (

func TestMigrateAuthSQlite(t *testing.T) {
// open db
db, err := sql.Open("sqlite", ":memory:")
db, err := sql.Open("sqlite3", ":memory:")
assert.NoError(t, err)

assert.NoError(t, auth.MigrateAuthDB(db, types.DATABASE_SQLITE))
Expand Down
10 changes: 5 additions & 5 deletions auth/auth_sqlite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

_ "modernc.org/sqlite"
_ "github.com/mattn/go-sqlite3"

"github.com/minetest-go/mtdb/auth"
"github.com/minetest-go/mtdb/types"
Expand All @@ -15,7 +15,7 @@ import (

func TestEmptySQliteRepo(t *testing.T) {
// open db
db, err := sql.Open("sqlite", ":memory:")
db, err := sql.Open("sqlite3", ":memory:")
assert.NoError(t, err)
repo := auth.NewAuthRepository(db, types.DATABASE_SQLITE)
assert.NotNil(t, repo)
Expand All @@ -33,7 +33,7 @@ func TestSQliteRepo(t *testing.T) {
copyFileContents("testdata/auth.wal.sqlite", dbfile.Name())

// open db
db, err := sql.Open("sqlite", "file:"+dbfile.Name())
db, err := sql.Open("sqlite3", "file:"+dbfile.Name())
assert.NoError(t, err)
repo := auth.NewAuthRepository(db, types.DATABASE_SQLITE)
assert.NotNil(t, repo)
Expand Down Expand Up @@ -99,7 +99,7 @@ func TestSQlitePrivRepo(t *testing.T) {
copyFileContents("testdata/auth.wal.sqlite", dbfile.Name())

// open db
db, err := sql.Open("sqlite", "file:"+dbfile.Name())
db, err := sql.Open("sqlite3", "file:"+dbfile.Name())
assert.NoError(t, err)
repo := auth.NewPrivilegeRepository(db, types.DATABASE_SQLITE)
assert.NotNil(t, repo)
Expand Down Expand Up @@ -155,7 +155,7 @@ func TestSqliteAuthRepo(t *testing.T) {
dbfile, err := os.CreateTemp(os.TempDir(), "auth.sqlite")
assert.NoError(t, err)
assert.NotNil(t, dbfile)
db, err := sql.Open("sqlite", "file:"+dbfile.Name())
db, err := sql.Open("sqlite3", "file:"+dbfile.Name())
assert.NoError(t, err)
assert.NoError(t, auth.MigrateAuthDB(db, types.DATABASE_SQLITE))
assert.NoError(t, wal.EnableWAL(db))
Expand Down
4 changes: 2 additions & 2 deletions block/block_migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"database/sql"
"testing"

_ "modernc.org/sqlite"
_ "github.com/mattn/go-sqlite3"

"github.com/minetest-go/mtdb/block"
"github.com/minetest-go/mtdb/types"
Expand All @@ -13,7 +13,7 @@ import (

func TestMigrateBlockSQlite(t *testing.T) {
// open db
db, err := sql.Open("sqlite", ":memory:")
db, err := sql.Open("sqlite3", ":memory:")
assert.NoError(t, err)

assert.NoError(t, block.MigrateBlockDB(db, types.DATABASE_SQLITE))
Expand Down
4 changes: 2 additions & 2 deletions block/block_sqlite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

_ "modernc.org/sqlite"
_ "github.com/mattn/go-sqlite3"

"github.com/minetest-go/mtdb/block"
"github.com/minetest-go/mtdb/types"
Expand All @@ -18,7 +18,7 @@ func TestSqliteBlockRepo(t *testing.T) {
dbfile, err := os.CreateTemp(os.TempDir(), "map.sqlite")
assert.NoError(t, err)
assert.NotNil(t, dbfile)
db, err := sql.Open("sqlite", "file:"+dbfile.Name())
db, err := sql.Open("sqlite3", "file:"+dbfile.Name())
assert.NoError(t, err)
assert.NoError(t, wal.EnableWAL(db))

Expand Down
4 changes: 2 additions & 2 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"path"

_ "github.com/lib/pq"
_ "github.com/mattn/go-sqlite3"
"github.com/minetest-go/mtdb/auth"
"github.com/minetest-go/mtdb/block"
"github.com/minetest-go/mtdb/mod_storage"
Expand All @@ -14,7 +15,6 @@ import (
"github.com/minetest-go/mtdb/wal"
"github.com/minetest-go/mtdb/worldconfig"
"github.com/sirupsen/logrus"
_ "modernc.org/sqlite"
)

type Context struct {
Expand Down Expand Up @@ -78,7 +78,7 @@ func connectAndMigrate(t types.DatabaseType, sqliteConn, psqlConn string, migFn
default:
// default to sqlite
datasource = sqliteConn
dbtype = "sqlite"
dbtype = "sqlite3"
}

if t == types.DATABASE_POSTGRES && datasource == "" {
Expand Down
2 changes: 1 addition & 1 deletion context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"

_ "github.com/lib/pq"
_ "modernc.org/sqlite"
_ "github.com/mattn/go-sqlite3"

"github.com/minetest-go/mtdb"
"github.com/stretchr/testify/assert"
Expand Down
24 changes: 3 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,16 @@ module github.com/minetest-go/mtdb

go 1.19

require modernc.org/sqlite v1.25.0

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/mattn/go-sqlite3 v1.14.17
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

require (
github.com/google/uuid v1.3.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/lib/pq v1.10.7
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/lib/pq v1.10.9
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
golang.org/x/tools v0.1.10 // indirect
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
lukechampine.com/uint128 v1.2.0 // indirect
modernc.org/cc/v3 v3.40.0 // indirect
modernc.org/ccgo/v3 v3.16.13 // indirect
modernc.org/libc v1.24.1 // indirect
modernc.org/mathutil v1.5.0 // indirect
modernc.org/memory v1.6.0 // indirect
modernc.org/opt v0.1.3 // indirect
modernc.org/strutil v1.1.3 // indirect
modernc.org/token v1.0.1 // indirect
golang.org/x/sys v0.11.0 // indirect
)
Loading

0 comments on commit 579df82

Please sign in to comment.