Add script to update go modules, add golangci-lint config

This commit is contained in:
Jan-Lukas Else 2021-12-07 14:13:09 +01:00
parent 2b1582f9f5
commit 604345e7c3
7 changed files with 25 additions and 8 deletions

12
.golangci.yml Normal file
View File

@ -0,0 +1,12 @@
run:
timeout: 5m
issue-exit-code: 0
skip-tests: true
build-tags:
- linux
- libsqlite3
- sqlite_fts5
linters:
enable:
- dupl
- gofmt

View File

@ -16,7 +16,7 @@ func Test_proxyTiles(t *testing.T) {
hc := &fakeHttpClient{
handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello, World!"))
_, _ = w.Write([]byte("Hello, World!"))
}),
}
app.httpClient = hc

2
go.mod
View File

@ -53,7 +53,7 @@ require (
github.com/yuin/goldmark-emoji v1.0.2-0.20210607094911-0487583eca38
github.com/yuin/goldmark-highlighting v0.0.0-20210516132338-9216f9c5aa01
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/text v0.3.7
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b

4
go.sum
View File

@ -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-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-20211205041911-012df41ee64c h1:7SfqwP5fxEtl/P02w5IhKc86ziJ+A25yFrkVgoy2FT8=
golang.org/x/net v0.0.0-20211205041911-012df41ee64c/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211206223403-eba003a116a9 h1:HhGRSJWlxVO54+s9MeOVrZrbnwv+6oZQIvsUrMUte7U=
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-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=

View File

@ -37,7 +37,7 @@ func Test_shortenPath(t *testing.T) {
assert.Equal(t, "/s/2", res3)
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")
require.NoError(t, err)

View File

@ -132,9 +132,10 @@ func (a *goBlog) initChromaCSS() error {
}
chromaTempFileName := chromaTempFile.Name()
// Write the CSS to the file
chromahtml.New(
chromahtml.ClassPrefix("c-"),
).WriteCSS(chromaTempFile, chromaStyle)
err = chromahtml.New(chromahtml.ClassPrefix("c-")).WriteCSS(chromaTempFile, chromaStyle)
if err != nil {
return err
}
// Close the file
_ = chromaTempFile.Close()
// Compile asset

4
updateDeps.sh Executable file
View File

@ -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