detached 10d06d2

Address CGO & sqlite3 building issues

- Migrate from mattn/go-sqlite3 to modernc.org/sqlite
- Update .gitignore and .goreleaser.yaml for new build configurations
- Add and update dependencies in go.mod and go.sum
commit
10d06d23b228a6325e68391aa39ed465ed03d5c7
author
bnema · · 2023-10-30 16:08 UTC
parent
4e979c5
signature
unsigned
6 files · +84 -27
M .gitignore +2 -0
@@ -8,4 +8,6 @@ bun.lockb
88 *.txt
99 *sync-conflict*
1010 main
11+gordon
1112 dist/
13+data/⏎̸
@@ -8,4 +8,6 @@ bun.lockb
8 *.txt8 *.txt
9 *sync-conflict*9 *sync-conflict*
10 main10 main
11+gordon
11 dist/12 dist/
13+data/⏎̸
M .goreleaser.yaml +14 -17
@@ -1,34 +1,31 @@
11 before:
22 hooks:
3- # You may remove this if you don't use go modules.
43 - go mod tidy
54
65 builds:
76 - id: "gordon"
87 main: ./cmd/cli/main.go
9- ldflags:
10- - -s -w -X main.build={{.Version}}
118 goos:
129 - linux
13- - windows
14- - darwin
10+ goarch:
11+ - amd64
12+ - arm64
13+ env:
14+ - CGO_ENABLED=0
15+
16+dockers:
17+ - image_templates:
18+ - bnema/gordon
19+ use: buildx
20+ skip_push: true
21+ dockerfile: Dockerfile
1522
1623 archives:
1724 - format: tar.gz
1825 # this name template makes the OS and Arch compatible with the results of `uname`.
19- name_template: >-
20- {{ .ProjectName }}_
21- {{- title .Os }}_
22- {{- if eq .Arch "amd64" }}x86_64
23- {{- else if eq .Arch "386" }}i386
24- {{- else }}{{ .Arch }}{{ end }}
25- {{- if .Arm }}v{{ .Arm }}{{ end }}
26- # use zip for windows archives
27- format_overrides:
28- - goos: windows
29- format: zip
26+ name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
3027
31-changelog:
28+changelog: # Added this section
3229 sort: asc
3330 filters:
3431 exclude:
@@ -1,34 +1,31 @@
1 before:1 before:
2 hooks:2 hooks:
3- # You may remove this if you don't use go modules.
4 - go mod tidy3 - go mod tidy
5 4
6 builds:5 builds:
7 - id: "gordon"6 - id: "gordon"
8 main: ./cmd/cli/main.go7 main: ./cmd/cli/main.go
9- ldflags:
10- - -s -w -X main.build={{.Version}}
11 goos:8 goos:
12 - linux9 - linux
13- - windows10+ goarch:
14- - darwin11+ - amd64
12+ - arm64
13+ env:
14+ - CGO_ENABLED=0
15+
16+dockers:
17+ - image_templates:
18+ - bnema/gordon
19+ use: buildx
20+ skip_push: true
21+ dockerfile: Dockerfile
15 22
16 archives:23 archives:
17 - format: tar.gz24 - format: tar.gz
18 # this name template makes the OS and Arch compatible with the results of `uname`.25 # this name template makes the OS and Arch compatible with the results of `uname`.
19- name_template: >-26+ name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
20- {{ .ProjectName }}_
21- {{- title .Os }}_
22- {{- if eq .Arch "amd64" }}x86_64
23- {{- else if eq .Arch "386" }}i386
24- {{- else }}{{ .Arch }}{{ end }}
25- {{- if .Arm }}v{{ .Arm }}{{ end }}
26- # use zip for windows archives
27- format_overrides:
28- - goos: windows
29- format: zip
30 27
31-changelog:28+changelog: # Added this section
32 sort: asc29 sort: asc
33 filters:30 filters:
34 exclude:31 exclude:
A Dockerfile +7 -0
@@ -0,0 +1,7 @@
1+FROM scratch
2+
3+COPY gordon /
4+
5+EXPOSE 1323
6+ENTRYPOINT ["/gordon"]
7+CMD ["serve"]
@@ -0,0 +1,7 @@
1+FROM scratch
2+
3+COPY gordon /
4+
5+EXPOSE 1323
6+ENTRYPOINT ["/gordon"]
7+CMD ["serve"]
M go.mod +16 -3
@@ -10,17 +10,30 @@ require (
1010 github.com/joho/godotenv v1.5.1
1111 github.com/labstack/echo-contrib v0.15.0
1212 github.com/labstack/echo/v4 v4.11.1
13- github.com/mattn/go-sqlite3 v1.14.17
1413 github.com/microcosm-cc/bluemonday v1.0.25
1514 github.com/spf13/cobra v1.7.0
1615 gopkg.in/yaml.v3 v3.0.1
16+ modernc.org/sqlite v1.26.0
1717 )
1818
1919 require (
20+ github.com/dustin/go-humanize v1.0.1 // indirect
2021 github.com/inconshreveable/mousetrap v1.1.0 // indirect
22+ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
2123 github.com/kr/text v0.2.0 // indirect
24+ github.com/mattn/go-sqlite3 v1.14.17 // indirect
25+ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
2226 github.com/spf13/pflag v1.0.5 // indirect
2327 github.com/stretchr/testify v1.8.2 // indirect
28+ lukechampine.com/uint128 v1.3.0 // indirect
29+ modernc.org/cc/v3 v3.41.0 // indirect
30+ modernc.org/ccgo/v3 v3.16.15 // indirect
31+ modernc.org/libc v1.29.0 // indirect
32+ modernc.org/mathutil v1.6.0 // indirect
33+ modernc.org/memory v1.7.2 // indirect
34+ modernc.org/opt v0.1.3 // indirect
35+ modernc.org/strutil v1.2.0 // indirect
36+ modernc.org/token v1.1.0 // indirect
2437 )
2538
2639 require (
@@ -31,13 +44,13 @@ require (
3144 github.com/docker/go-units v0.5.0 // indirect
3245 github.com/gogo/protobuf v1.3.2 // indirect
3346 github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
34- github.com/google/uuid v1.3.1 // direct
47+ github.com/google/uuid v1.4.0 // direct
3548 github.com/gorilla/context v1.1.1 // indirect
3649 github.com/gorilla/css v1.0.0 // indirect
3750 github.com/gorilla/securecookie v1.1.1 // indirect
3851 github.com/labstack/gommon v0.4.0 // indirect
3952 github.com/mattn/go-colorable v0.1.13 // indirect
40- github.com/mattn/go-isatty v0.0.19 // indirect
53+ github.com/mattn/go-isatty v0.0.20 // indirect
4154 github.com/moby/term v0.5.0 // indirect
4255 github.com/morikuni/aec v1.0.0 // indirect
4356 github.com/opencontainers/go-digest v1.0.0 // indirect
@@ -10,17 +10,30 @@ require (
10 github.com/joho/godotenv v1.5.110 github.com/joho/godotenv v1.5.1
11 github.com/labstack/echo-contrib v0.15.011 github.com/labstack/echo-contrib v0.15.0
12 github.com/labstack/echo/v4 v4.11.112 github.com/labstack/echo/v4 v4.11.1
13- github.com/mattn/go-sqlite3 v1.14.17
14 github.com/microcosm-cc/bluemonday v1.0.2513 github.com/microcosm-cc/bluemonday v1.0.25
15 github.com/spf13/cobra v1.7.014 github.com/spf13/cobra v1.7.0
16 gopkg.in/yaml.v3 v3.0.115 gopkg.in/yaml.v3 v3.0.1
16+ modernc.org/sqlite v1.26.0
17 )17 )
18 18
19 require (19 require (
20+ github.com/dustin/go-humanize v1.0.1 // indirect
20 github.com/inconshreveable/mousetrap v1.1.0 // indirect21 github.com/inconshreveable/mousetrap v1.1.0 // indirect
22+ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
21 github.com/kr/text v0.2.0 // indirect23 github.com/kr/text v0.2.0 // indirect
24+ github.com/mattn/go-sqlite3 v1.14.17 // indirect
25+ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
22 github.com/spf13/pflag v1.0.5 // indirect26 github.com/spf13/pflag v1.0.5 // indirect
23 github.com/stretchr/testify v1.8.2 // indirect27 github.com/stretchr/testify v1.8.2 // indirect
28+ lukechampine.com/uint128 v1.3.0 // indirect
29+ modernc.org/cc/v3 v3.41.0 // indirect
30+ modernc.org/ccgo/v3 v3.16.15 // indirect
31+ modernc.org/libc v1.29.0 // indirect
32+ modernc.org/mathutil v1.6.0 // indirect
33+ modernc.org/memory v1.7.2 // indirect
34+ modernc.org/opt v0.1.3 // indirect
35+ modernc.org/strutil v1.2.0 // indirect
36+ modernc.org/token v1.1.0 // indirect
24 )37 )
25 38
26 require (39 require (
@@ -31,13 +44,13 @@ require (
31 github.com/docker/go-units v0.5.0 // indirect44 github.com/docker/go-units v0.5.0 // indirect
32 github.com/gogo/protobuf v1.3.2 // indirect45 github.com/gogo/protobuf v1.3.2 // indirect
33 github.com/golang-jwt/jwt v3.2.2+incompatible // indirect46 github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
34- github.com/google/uuid v1.3.1 // direct47+ github.com/google/uuid v1.4.0 // direct
35 github.com/gorilla/context v1.1.1 // indirect48 github.com/gorilla/context v1.1.1 // indirect
36 github.com/gorilla/css v1.0.0 // indirect49 github.com/gorilla/css v1.0.0 // indirect
37 github.com/gorilla/securecookie v1.1.1 // indirect50 github.com/gorilla/securecookie v1.1.1 // indirect
38 github.com/labstack/gommon v0.4.0 // indirect51 github.com/labstack/gommon v0.4.0 // indirect
39 github.com/mattn/go-colorable v0.1.13 // indirect52 github.com/mattn/go-colorable v0.1.13 // indirect
40- github.com/mattn/go-isatty v0.0.19 // indirect53+ github.com/mattn/go-isatty v0.0.20 // indirect
41 github.com/moby/term v0.5.0 // indirect54 github.com/moby/term v0.5.0 // indirect
42 github.com/morikuni/aec v1.0.0 // indirect55 github.com/morikuni/aec v1.0.0 // indirect
43 github.com/opencontainers/go-digest v1.0.0 // indirect56 github.com/opencontainers/go-digest v1.0.0 // indirect
M go.sum +40 -4 generated file: collapsed
M internal/server/sqliteinit.go +5 -3
@@ -8,7 +8,7 @@ import (
88
99 "github.com/bnema/gordon/internal/db"
1010 pkgsqlite "github.com/bnema/gordon/pkg/sqlite"
11- _ "github.com/mattn/go-sqlite3"
11+ _ "modernc.org/sqlite"
1212 )
1313
1414 const (
@@ -59,7 +59,8 @@ func InitializeDB(a *App) (*sql.DB, error) {
5959 }
6060 }
6161
62- db, err := sql.Open("sqlite3", dbPath)
62+ // Change here from "sqlite3" to "sqlite"
63+ db, err := sql.Open("sqlite", dbPath)
6364 if err != nil {
6465 return nil, fmt.Errorf("failed to open disk DB: %w", err)
6566 }
@@ -77,7 +78,8 @@ func InitializeDB(a *App) (*sql.DB, error) {
7778 }
7879
7980 func bootstrapDB(dbPath string, app *App) error {
80- db, err := sql.Open("sqlite3", dbPath)
81+ // Change here from "sqlite3" to "sqlite"
82+ db, err := sql.Open("sqlite", dbPath)
8183 if err != nil {
8284 return err
8385 }
@@ -8,7 +8,7 @@ import (
8 8
9 "github.com/bnema/gordon/internal/db"9 "github.com/bnema/gordon/internal/db"
10 pkgsqlite "github.com/bnema/gordon/pkg/sqlite"10 pkgsqlite "github.com/bnema/gordon/pkg/sqlite"
11- _ "github.com/mattn/go-sqlite3"11+ _ "modernc.org/sqlite"
12 )12 )
13 13
14 const (14 const (
@@ -59,7 +59,8 @@ func InitializeDB(a *App) (*sql.DB, error) {
59 }59 }
60 }60 }
61 61
62- db, err := sql.Open("sqlite3", dbPath)62+ // Change here from "sqlite3" to "sqlite"
63+ db, err := sql.Open("sqlite", dbPath)
63 if err != nil {64 if err != nil {
64 return nil, fmt.Errorf("failed to open disk DB: %w", err)65 return nil, fmt.Errorf("failed to open disk DB: %w", err)
65 }66 }
@@ -77,7 +78,8 @@ func InitializeDB(a *App) (*sql.DB, error) {
77 }78 }
78 79
79 func bootstrapDB(dbPath string, app *App) error {80 func bootstrapDB(dbPath string, app *App) error {
80- db, err := sql.Open("sqlite3", dbPath)81+ // Change here from "sqlite3" to "sqlite"
82+ db, err := sql.Open("sqlite", dbPath)
81 if err != nil {83 if err != nil {
82 return err84 return err
83 }85 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close