Skip to content

Commit b855585

Browse files
authored
Merge pull request #95 from spinup-host/viggy/gh-94
gh-94: To replace mattn/go-sqlite3 with cznic/sqlite
2 parents 276bdfc + 5f58674 commit b855585

5 files changed

Lines changed: 156 additions & 38 deletions

File tree

.github/workflows/go.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ jobs:
2323
github_token: ${{ secrets.GITHUB_TOKEN }}
2424
goos: ${{ matrix.goos }}
2525
goarch: ${{ matrix.goarch }}
26-
pre_command: export CGO_ENABLED=1
2726
goversion: "https://dl.google.com/go/go1.16.5.linux-amd64.tar.gz"
2827
binary_name: "spinup-backend"
2928
ldflags: "-X 'main.apiVersion=$RELEASE_TAG_NAME'"

api/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ import (
1818
"github.com/spinup-host/internal/dockerservice"
1919

2020
"github.com/docker/docker/client"
21-
_ "github.com/mattn/go-sqlite3"
2221
"github.com/robfig/cron/v3"
2322
"github.com/spinup-host/backup"
2423
"github.com/spinup-host/config"
2524
"github.com/spinup-host/misc"
25+
_ "modernc.org/sqlite"
2626
)
2727

2828
type service struct {
@@ -286,7 +286,7 @@ func lastContainerID() (string, error) {
286286
}
287287

288288
func OpenSqliteDB(path string) (*sql.DB, error) {
289-
db, err := sql.Open("sqlite3", path)
289+
db, err := sql.Open("sqlite", path)
290290
if err != nil {
291291
return nil, err
292292
}

api/list_cluster.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
"os"
1212

1313
"github.com/spinup-host/config"
14+
15+
_ "modernc.org/sqlite"
1416
)
1517

1618
func ListCluster(w http.ResponseWriter, req *http.Request) {
@@ -53,7 +55,7 @@ func ReadClusterInfo(path, dbName string) []clusterInfo {
5355
log.Printf("INFO: no sqlite database")
5456
return nil
5557
}
56-
db, err := sql.Open("sqlite3", dsn)
58+
db, err := sql.Open("sqlite", dsn)
5759
if err != nil {
5860
log.Fatal(err)
5961
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ require (
99
github.com/golang-jwt/jwt v3.2.1+incompatible
1010
github.com/gorilla/mux v1.8.0 // indirect
1111
github.com/gorilla/websocket v1.4.2
12-
github.com/mattn/go-sqlite3 v1.14.8
1312
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
1413
github.com/morikuni/aec v1.0.0 // indirect
1514
github.com/prometheus/client_golang v1.11.0
@@ -18,4 +17,5 @@ require (
1817
github.com/rs/zerolog v1.25.0
1918
github.com/spf13/cobra v1.2.1
2019
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
20+
modernc.org/sqlite v1.14.7
2121
)

0 commit comments

Comments
 (0)