Skip to content

Commit 2d475f8

Browse files
committed
Merge branch 'master' into no-acc-windows
2 parents 1c5fa2f + 48c6a56 commit 2d475f8

File tree

4 files changed

+38
-12
lines changed

4 files changed

+38
-12
lines changed

.github/workflows/go.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
os: [ubuntu-latest, macos-latest]
17-
go: ['1.12.17', '1.13.15', '1.14.7', '1.15', '1.16', '1.17']
17+
go: ['1.15', '1.16', '1.17']
1818
fail-fast: false
1919
env:
2020
OS: ${{ matrix.os }}

upgrade/go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/mattn/go-sqlite3/upgrade
2+
3+
go 1.16
4+
5+
require github.com/PuerkitoBio/goquery v1.7.1 // indirect

upgrade/go.sum

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
github.com/PuerkitoBio/goquery v1.7.1 h1:oE+T06D+1T7LNrn91B4aERsRIeCLJ/oPSa6xB9FPnz4=
2+
github.com/PuerkitoBio/goquery v1.7.1/go.mod h1:XY0pP4kfraEmmV1O7Uf6XyjoslwsneBbgeDjLYuN8xY=
3+
github.com/andybalholm/cascadia v1.2.0 h1:vuRCkM5Ozh/BfmsaTm26kbjm0mIOM3yS5Ek/F5h18aE=
4+
github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxBp0T0eFw1RUQY=
5+
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
6+
golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q=
7+
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
8+
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
9+
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
10+
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
11+
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
12+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

upgrade/upgrade.go

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// +build !cgo
2-
// +build upgrade,ignore
1+
//go:build !cgo && upgrade && ignore
2+
// +build !cgo,upgrade,ignore
33

44
package main
55

@@ -98,16 +98,25 @@ func mergeFile(src string, dst string) error {
9898
func main() {
9999
fmt.Println("Go-SQLite3 Upgrade Tool")
100100

101+
wd, err := os.Getwd()
102+
if err != nil {
103+
log.Fatal(err)
104+
}
105+
if filepath.Base(wd) != "upgrade" {
106+
log.Printf("Current directory is %q but should run in upgrade directory", wd)
107+
os.Exit(1)
108+
}
109+
101110
// Download Amalgamation
102111
_, amalgamation, err := download("sqlite-amalgamation-")
103112
if err != nil {
104-
fmt.Println("Failed to download: sqlite-amalgamation; %s", err)
113+
log.Fatalf("Failed to download: sqlite-amalgamation; %s", err)
105114
}
106115

107116
// Download Source
108117
_, source, err := download("sqlite-src-")
109118
if err != nil {
110-
fmt.Println("Failed to download: sqlite-src; %s", err)
119+
log.Fatalf("Failed to download: sqlite-src; %s", err)
111120
}
112121

113122
// Create Amalgamation Zip Reader
@@ -127,11 +136,11 @@ func main() {
127136
var f *os.File
128137
switch path.Base(zf.Name) {
129138
case "sqlite3.c":
130-
f, err = os.Create("sqlite3-binding.c")
139+
f, err = os.Create("../sqlite3-binding.c")
131140
case "sqlite3.h":
132-
f, err = os.Create("sqlite3-binding.h")
141+
f, err = os.Create("../sqlite3-binding.h")
133142
case "sqlite3ext.h":
134-
f, err = os.Create("sqlite3ext.h")
143+
f, err = os.Create("../sqlite3ext.h")
135144
default:
136145
continue
137146
}
@@ -186,9 +195,9 @@ func main() {
186195
var f *os.File
187196
switch path.Base(zf.Name) {
188197
case "userauth.c":
189-
f, err = os.Create("userauth.c")
198+
f, err = os.Create("../userauth.c")
190199
case "sqlite3userauth.h":
191-
f, err = os.Create("userauth.h")
200+
f, err = os.Create("../userauth.h")
192201
default:
193202
continue
194203
}
@@ -211,10 +220,10 @@ func main() {
211220
}
212221

213222
// Merge SQLite User Authentication into amalgamation
214-
if err := mergeFile("userauth.c", "sqlite3-binding.c"); err != nil {
223+
if err := mergeFile("../userauth.c", "../sqlite3-binding.c"); err != nil {
215224
log.Fatal(err)
216225
}
217-
if err := mergeFile("userauth.h", "sqlite3-binding.h"); err != nil {
226+
if err := mergeFile("../userauth.h", "../sqlite3-binding.h"); err != nil {
218227
log.Fatal(err)
219228
}
220229

0 commit comments

Comments
 (0)