Skip to content

Commit

Permalink
Update go to 1.23, golangci-lint to 1.61, baseimage to 1.14
Browse files Browse the repository at this point in the history
  • Loading branch information
paskal committed Nov 8, 2024
1 parent 32a9e0c commit 5a6f6c7
Show file tree
Hide file tree
Showing 21 changed files with 13 additions and 34 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: install go
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.23"

- name: test and build backend
run: |
Expand All @@ -54,13 +54,13 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.58
version: v1.61.0
working-directory: backend/app

- name: golangci-lint on example directory
uses: golangci/golangci-lint-action@v3
with:
version: v1.58
version: v1.61.0
args: --config ../../.golangci.yml
working-directory: backend/_example/memory_store

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ RUN \
echo 'Skip frontend build'; \
fi

FROM umputun/baseimage:buildgo-v1.13.0 as build-backend
FROM umputun/baseimage:buildgo-v1.14.0 as build-backend

ARG CI
ARG GITHUB_REF
Expand Down Expand Up @@ -81,7 +81,7 @@ RUN \
echo "version=$version" && \
go build -o remark42 -ldflags "-X main.revision=${version} -s -w" ./app

FROM umputun/baseimage:app-v1.13.0
FROM umputun/baseimage:app-v1.14.0

ARG GITHUB_SHA

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.artifacts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ WORKDIR /srv/frontend/apps/remark42/
COPY ./frontend/apps/remark42/ /srv/frontend/apps/remark42/
RUN pnpm build

FROM umputun/baseimage:buildgo-v1.13.0 as build-backend
FROM umputun/baseimage:buildgo-v1.14.0 as build-backend

ARG GITHUB_TOKEN
ARG GITHUB_REF
Expand Down
2 changes: 1 addition & 1 deletion backend/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ linters-settings:
linters:
enable:
- bodyclose
- copyloopvar
- dupl
- exportloopref
- gochecknoinits
- gocritic
- gocyclo
Expand Down
4 changes: 2 additions & 2 deletions backend/_example/memory_store/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM umputun/baseimage:buildgo-v1.13.0 as build-backend
FROM umputun/baseimage:buildgo-v1.14.0 as build-backend

ADD backend /build/backend
WORKDIR /build/backend/_example/memory_store

RUN go build -o /build/bin/memory_store -ldflags "-X main.revision=0.0.0 -s -w"

FROM umputun/baseimage:app-v1.13.0
FROM umputun/baseimage:app-v1.14.0

ARG GITHUB_SHA

Expand Down
3 changes: 1 addition & 2 deletions backend/_example/memory_store/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/umputun/remark42/memory_store

go 1.21
go 1.23

require (
github.com/go-pkgz/jrpc v0.3.0
Expand Down Expand Up @@ -36,7 +36,6 @@ require (
golang.org/x/image v0.22.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.25.0 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down
3 changes: 1 addition & 2 deletions backend/_example/memory_store/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
1 change: 0 additions & 1 deletion backend/app/cmd/cleanup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func TestCleanup_IsSpam(t *testing.T) {
}

for n, tt := range tbl {
tt := tt
checkName := fmt.Sprintf("check-%d-%s", n, tt.name)
t.Run(checkName, func(t *testing.T) {
c := store.Comment{ID: checkName, Text: tt.text, Score: tt.score}
Expand Down
1 change: 0 additions & 1 deletion backend/app/cmd/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,6 @@ func TestServerCommand_parseSameSite(t *testing.T) {

cmd := ServerCommand{}
for i, tt := range tbl {
tt := tt
t.Run(strconv.Itoa(i), func(t *testing.T) {
assert.Equal(t, tt.res, cmd.parseSameSite(tt.inp))
})
Expand Down
1 change: 0 additions & 1 deletion backend/app/notify/email_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func Test_initTemplatesErr(t *testing.T) {
}

for _, d := range testSet {
d := d
t.Run(d.name, func(t *testing.T) {
e, err := NewEmail(d.emailParams, ntf.SMTPParams{})
require.Error(t, err)
Expand Down
1 change: 0 additions & 1 deletion backend/app/rest/api/rest_private_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,6 @@ func TestRest_EmailAndTelegram(t *testing.T) {
client := http.Client{}
defer client.CloseIdleConnections()
for _, x := range testData {
x := x
t.Run(x.description, func(t *testing.T) {
reqBody := io.NopCloser(strings.NewReader(x.body))
if x.body == "" {
Expand Down
5 changes: 0 additions & 5 deletions backend/app/rest/api/rest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ func Test_URLKey(t *testing.T) {
}

for i, tt := range tbl {
tt := tt
t.Run(strconv.Itoa(i), func(t *testing.T) {
r, err := http.NewRequest("GET", tt.url, http.NoBody)
require.NoError(t, err)
Expand All @@ -252,7 +251,6 @@ func Test_URLKeyWithUser(t *testing.T) {
}

for i, tt := range tbl {
tt := tt
t.Run(strconv.Itoa(i), func(t *testing.T) {
r, err := http.NewRequest("GET", tt.url, http.NoBody)
require.NoError(t, err)
Expand All @@ -279,7 +277,6 @@ func TestRest_parseError(t *testing.T) {
}

for n, tt := range tbl {
tt := tt
t.Run(strconv.Itoa(n), func(t *testing.T) {
res := parseError(tt.err, rest.ErrInternal)
assert.Equal(t, tt.res, res)
Expand All @@ -302,7 +299,6 @@ func TestRest_cacheControl(t *testing.T) {
}

for i, tt := range tbl {
tt := tt
t.Run(strconv.Itoa(i), func(t *testing.T) {
req := httptest.NewRequest("GET", tt.url, http.NoBody)
w := httptest.NewRecorder()
Expand Down Expand Up @@ -388,7 +384,6 @@ func TestRest_subscribersOnly(t *testing.T) {
}

for i, tt := range tbl {
tt := tt
t.Run(strconv.Itoa(i), func(t *testing.T) {
req := httptest.NewRequest("GET", "http://example.com", http.NoBody)
if tt.setUser {
Expand Down
1 change: 0 additions & 1 deletion backend/app/rest/proxy/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ func TestImage_Extract(t *testing.T) {
img := Image{HTTP2HTTPS: true}

for i, tt := range tbl {
tt := tt
t.Run(strconv.Itoa(i), func(t *testing.T) {
res, err := img.extract(tt.inp, func(src string) bool { return strings.HasPrefix(src, "http://") })
assert.NoError(t, err)
Expand Down
3 changes: 0 additions & 3 deletions backend/app/store/comment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ func TestComment_Snippet(t *testing.T) {
}

for i, tt := range tbl {
tt := tt
t.Run(strconv.Itoa(i), func(t *testing.T) {
c := Comment{Text: tt.inp}
out := c.Snippet(tt.limit)
Expand Down Expand Up @@ -245,7 +244,6 @@ func TestComment_sanitizeAsURL(t *testing.T) {
}

for i, tt := range tbl {
tt := tt
c := Comment{}
t.Run(strconv.Itoa(i), func(t *testing.T) {
assert.Equal(t, tt.out, c.SanitizeAsURL(tt.inp))
Expand Down Expand Up @@ -276,7 +274,6 @@ func TestComment_sanitizeText(t *testing.T) {
}

for i, tt := range tbl {
tt := tt
c := Comment{}
t.Run(strconv.Itoa(i), func(t *testing.T) {
assert.Equal(t, tt.out, c.SanitizeText(tt.inp))
Expand Down
1 change: 0 additions & 1 deletion backend/app/store/engine/bolt.go
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,6 @@ func (b *BoltDB) deleteUser(bdb *bolt.DB, siteID, userID string, mode store.Dele
// get list of commentID for all user's comment
comments := []commentInfo{}
for _, postInfo := range posts {
postInfo := postInfo
err = bdb.View(func(tx *bolt.Tx) error {
postsBkt := tx.Bucket([]byte(postsBucketName))
postBkt := postsBkt.Bucket([]byte(postInfo.URL))
Expand Down
2 changes: 0 additions & 2 deletions backend/app/store/formatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func TestFormatter_FormatText(t *testing.T) {
}
f := NewCommentFormatter(mockConverter{})
for _, tt := range tbl {
tt := tt
t.Run(tt.name, func(t *testing.T) {
raw := strings.HasPrefix(tt.in, `no_smartpants`)
t.Logf("raw: %v", raw)
Expand Down Expand Up @@ -146,7 +145,6 @@ func TestCommentFormatter_lazyImage(t *testing.T) {

f := NewCommentFormatter(nil)
for i, tt := range tbl {
tt := tt
t.Run(strconv.Itoa(i), func(t *testing.T) {
assert.Equal(t, tt.out, f.lazyImage(tt.inp))
})
Expand Down
1 change: 0 additions & 1 deletion backend/app/store/image/fs_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ func TestFsStore_location(t *testing.T) {
{0, "user/12345", "/tmp/user/12345"},
}
for n, tt := range tbl {
tt := tt
t.Run(strconv.Itoa(n), func(t *testing.T) {
svc := FileSystem{Location: "/tmp", Partitions: tt.partitions}
assert.Equal(t, tt.res, svc.location("/tmp", tt.id))
Expand Down
1 change: 0 additions & 1 deletion backend/app/store/image/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ func TestGetProportionalSizes(t *testing.T) {
}

for i, tt := range tbl {
tt := tt
t.Run(strconv.Itoa(i), func(t *testing.T) {
resW, resH := getProportionalSizes(tt.inpW, tt.inpH, tt.limitW, tt.limitH)
assert.Equal(t, tt.resW, resW, "width")
Expand Down
1 change: 0 additions & 1 deletion backend/app/store/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,6 @@ func TestService_Controversy(t *testing.T) {

b := DataStore{}
for i, tt := range tbl {
tt := tt
t.Run(fmt.Sprintf("check-%d-%d:%d", i, tt.ups, tt.downs), func(t *testing.T) {
assert.InDelta(t, tt.res, b.controversy(tt.ups, tt.downs), 0.01)
})
Expand Down
1 change: 0 additions & 1 deletion backend/app/store/service/title_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func TestTitle_GetTitle(t *testing.T) {
ex := NewTitleExtractor(http.Client{Timeout: 5 * time.Second}, []string{})
defer ex.Close()
for i, tt := range tbl {
tt := tt
t.Run(fmt.Sprintf("check-%d", i), func(t *testing.T) {
title, ok := ex.getTitle(strings.NewReader(tt.page))
assert.Equal(t, tt.ok, ok)
Expand Down
3 changes: 2 additions & 1 deletion backend/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module github.com/umputun/remark42/backend

go 1.21
go 1.23

toolchain go1.23.3

require (
Expand Down

0 comments on commit 5a6f6c7

Please sign in to comment.