mirror of https://github.com/jlelse/GoBlog
Add script to update go modules, add golangci-lint config
This commit is contained in:
parent
2b1582f9f5
commit
604345e7c3
|
@ -0,0 +1,12 @@
|
||||||
|
run:
|
||||||
|
timeout: 5m
|
||||||
|
issue-exit-code: 0
|
||||||
|
skip-tests: true
|
||||||
|
build-tags:
|
||||||
|
- linux
|
||||||
|
- libsqlite3
|
||||||
|
- sqlite_fts5
|
||||||
|
linters:
|
||||||
|
enable:
|
||||||
|
- dupl
|
||||||
|
- gofmt
|
|
@ -16,7 +16,7 @@ func Test_proxyTiles(t *testing.T) {
|
||||||
|
|
||||||
hc := &fakeHttpClient{
|
hc := &fakeHttpClient{
|
||||||
handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Write([]byte("Hello, World!"))
|
_, _ = w.Write([]byte("Hello, World!"))
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
app.httpClient = hc
|
app.httpClient = hc
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -53,7 +53,7 @@ require (
|
||||||
github.com/yuin/goldmark-emoji v1.0.2-0.20210607094911-0487583eca38
|
github.com/yuin/goldmark-emoji v1.0.2-0.20210607094911-0487583eca38
|
||||||
github.com/yuin/goldmark-highlighting v0.0.0-20210516132338-9216f9c5aa01
|
github.com/yuin/goldmark-highlighting v0.0.0-20210516132338-9216f9c5aa01
|
||||||
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e
|
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e
|
||||||
golang.org/x/net v0.0.0-20211205041911-012df41ee64c
|
golang.org/x/net v0.0.0-20211206223403-eba003a116a9
|
||||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
||||||
golang.org/x/text v0.3.7
|
golang.org/x/text v0.3.7
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -635,8 +635,8 @@ golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qx
|
||||||
golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20211020060615-d418f374d309/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211020060615-d418f374d309/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20211205041911-012df41ee64c h1:7SfqwP5fxEtl/P02w5IhKc86ziJ+A25yFrkVgoy2FT8=
|
golang.org/x/net v0.0.0-20211206223403-eba003a116a9 h1:HhGRSJWlxVO54+s9MeOVrZrbnwv+6oZQIvsUrMUte7U=
|
||||||
golang.org/x/net v0.0.0-20211205041911-012df41ee64c/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211206223403-eba003a116a9/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
|
|
|
@ -37,7 +37,7 @@ func Test_shortenPath(t *testing.T) {
|
||||||
assert.Equal(t, "/s/2", res3)
|
assert.Equal(t, "/s/2", res3)
|
||||||
|
|
||||||
db.spc.Delete("/a")
|
db.spc.Delete("/a")
|
||||||
db.exec("delete from shortpath where id = 1")
|
_, _ = db.exec("delete from shortpath where id = 1")
|
||||||
|
|
||||||
res4, err := db.shortenPath("/c")
|
res4, err := db.shortenPath("/c")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
|
@ -132,9 +132,10 @@ func (a *goBlog) initChromaCSS() error {
|
||||||
}
|
}
|
||||||
chromaTempFileName := chromaTempFile.Name()
|
chromaTempFileName := chromaTempFile.Name()
|
||||||
// Write the CSS to the file
|
// Write the CSS to the file
|
||||||
chromahtml.New(
|
err = chromahtml.New(chromahtml.ClassPrefix("c-")).WriteCSS(chromaTempFile, chromaStyle)
|
||||||
chromahtml.ClassPrefix("c-"),
|
if err != nil {
|
||||||
).WriteCSS(chromaTempFile, chromaStyle)
|
return err
|
||||||
|
}
|
||||||
// Close the file
|
// Close the file
|
||||||
_ = chromaTempFile.Close()
|
_ = chromaTempFile.Close()
|
||||||
// Compile asset
|
// Compile asset
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
GOFLAGS="-tags=linux,libsqlite3,sqlite_fts5" go get -d $(go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)
|
||||||
|
GOFLAGS="-tags=linux,libsqlite3,sqlite_fts5" go mod tidy -compat 1.17
|
Loading…
Reference in New Issue