chore(deps): update dependency golang to v1.19 (#1228)

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/api/pulls/1228
Co-authored-by: renovate <renovatebot@kolaente.de>
Co-committed-by: renovate <renovatebot@kolaente.de>
This commit is contained in:
renovate 2022-10-01 15:05:12 +00:00 committed by konrad
parent 878d19beb8
commit c5bd09702a
14 changed files with 38 additions and 35 deletions

View file

@ -132,14 +132,15 @@ steps:
event: [ push, tag, pull_request ] event: [ push, tag, pull_request ]
- name: lint - name: lint
image: golang:1.17-alpine image: golang:1.19-alpine
pull: true pull: true
environment: environment:
GOPROXY: 'https://goproxy.kolaente.de' GOPROXY: 'https://goproxy.kolaente.de'
depends_on: [ build ] depends_on: [ build ]
commands: commands:
- export "GOROOT=$(go env GOROOT)"
- apk --no-cache add build-base git - apk --no-cache add build-base git
- wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.47.3 - wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.49.0
- ./mage-static check:all - ./mage-static check:all
when: when:
event: [ push, tag, pull_request ] event: [ push, tag, pull_request ]
@ -878,6 +879,6 @@ steps:
- failure - failure
--- ---
kind: signature kind: signature
hmac: d95e5d4b31e22079ce6360f31ec9257b26cd206b614cb1ec660290c061eced8f hmac: 9ca8948161dc6ac167aa3f01d2798745f58550b24c6ced4a81bf64b5b129f172
... ...

View file

@ -1,7 +1,7 @@
############## ##############
# Build stage # Build stage
FROM golang:1.18-alpine AS build-env FROM golang:1.19-alpine AS build-env
RUN apk --no-cache add build-base git && \ RUN apk --no-cache add build-base git && \
go install github.com/magefile/mage@latest && \ go install github.com/magefile/mage@latest && \

View file

@ -1,7 +1,7 @@
############## ##############
# Build stage # Build stage
FROM golang:1.18-buster AS build-env FROM golang:1.19-buster AS build-env
RUN go install github.com/magefile/mage@latest && \ RUN go install github.com/magefile/mage@latest && \
mv /go/bin/mage /usr/local/go/bin mv /go/bin/mage /usr/local/go/bin

View file

@ -27,7 +27,6 @@ import (
"fmt" "fmt"
"github.com/iancoleman/strcase" "github.com/iancoleman/strcase"
"io" "io"
"io/ioutil"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
@ -701,14 +700,14 @@ func (Release) Packages() error {
// Because nfpm does not support templating, we replace the values in the config file and restore it after running // Because nfpm does not support templating, we replace the values in the config file and restore it after running
nfpmConfigPath := RootPath + "/nfpm.yaml" nfpmConfigPath := RootPath + "/nfpm.yaml"
nfpmconfig, err := ioutil.ReadFile(nfpmConfigPath) nfpmconfig, err := os.ReadFile(nfpmConfigPath)
if err != nil { if err != nil {
return err return err
} }
fixedConfig := strings.ReplaceAll(string(nfpmconfig), "<version>", VersionNumber) fixedConfig := strings.ReplaceAll(string(nfpmconfig), "<version>", VersionNumber)
fixedConfig = strings.ReplaceAll(fixedConfig, "<binlocation>", BinLocation) fixedConfig = strings.ReplaceAll(fixedConfig, "<binlocation>", BinLocation)
if err := ioutil.WriteFile(nfpmConfigPath, []byte(fixedConfig), 0); err != nil { if err := os.WriteFile(nfpmConfigPath, []byte(fixedConfig), 0); err != nil {
return err return err
} }
@ -721,7 +720,7 @@ func (Release) Packages() error {
runAndStreamOutput(binpath, "pkg", "--packager", "rpm", "--target", releasePath) runAndStreamOutput(binpath, "pkg", "--packager", "rpm", "--target", releasePath)
runAndStreamOutput(binpath, "pkg", "--packager", "apk", "--target", releasePath) runAndStreamOutput(binpath, "pkg", "--packager", "apk", "--target", releasePath)
return ioutil.WriteFile(nfpmConfigPath, nfpmconfig, 0) return os.WriteFile(nfpmConfigPath, nfpmconfig, 0)
} }
type Dev mg.Namespace type Dev mg.Namespace
@ -885,7 +884,7 @@ func (s *` + name + `) Handle(msg *message.Message) (err error) {
if _, err := f.Seek(idx, 0); err != nil { if _, err := f.Seek(idx, 0); err != nil {
return err return err
} }
remainder, err := ioutil.ReadAll(f) remainder, err := io.ReadAll(f)
if err != nil { if err != nil {
return err return err
} }
@ -1074,7 +1073,7 @@ const (
// Generates the config docs from a commented config.yml.sample file in the repo root. // Generates the config docs from a commented config.yml.sample file in the repo root.
func GenerateDocs() error { func GenerateDocs() error {
config, err := ioutil.ReadFile("config.yml.sample") config, err := os.ReadFile("config.yml.sample")
if err != nil { if err != nil {
return err return err
} }
@ -1124,7 +1123,7 @@ func GenerateDocs() error {
// We write the full file to prevent old content leftovers at the end // We write the full file to prevent old content leftovers at the end
// I know, there are probably better ways to do this. // I know, there are probably better ways to do this.
if err := ioutil.WriteFile(configDocPath, []byte(fullConfig), 0); err != nil { if err := os.WriteFile(configDocPath, []byte(fullConfig), 0); err != nil {
return err return err
} }

View file

@ -66,6 +66,7 @@ func (ld *ListDuplicate) CanCreate(s *xorm.Session, a web.Auth) (canCreate bool,
// @Failure 403 {object} web.HTTPError "The user does not have access to the list or namespace" // @Failure 403 {object} web.HTTPError "The user does not have access to the list or namespace"
// @Failure 500 {object} models.Message "Internal error" // @Failure 500 {object} models.Message "Internal error"
// @Router /lists/{listID}/duplicate [put] // @Router /lists/{listID}/duplicate [put]
//
//nolint:gocyclo //nolint:gocyclo
func (ld *ListDuplicate) Create(s *xorm.Session, doer web.Auth) (err error) { func (ld *ListDuplicate) Create(s *xorm.Session, doer web.Auth) (err error) {

View file

@ -480,6 +480,7 @@ func getSavedFilters(s *xorm.Session, doer *user.User) (savedFiltersNamespace *N
// @Success 200 {array} models.NamespaceWithLists "The Namespaces." // @Success 200 {array} models.NamespaceWithLists "The Namespaces."
// @Failure 500 {object} models.Message "Internal error" // @Failure 500 {object} models.Message "Internal error"
// @Router /namespaces [get] // @Router /namespaces [get]
//
//nolint:gocyclo //nolint:gocyclo
func (n *Namespace) ReadAll(s *xorm.Session, a web.Auth, search string, page int, perPage int) (result interface{}, resultCount int, numberOfTotalItems int64, err error) { func (n *Namespace) ReadAll(s *xorm.Session, a web.Auth, search string, page int, perPage int) (result interface{}, resultCount int, numberOfTotalItems int64, err error) {
if _, is := a.(*LinkSharing); is { if _, is := a.(*LinkSharing); is {

View file

@ -979,6 +979,7 @@ func createTask(s *xorm.Session, t *Task, a web.Auth, updateAssignees bool) (err
// @Failure 403 {object} web.HTTPError "The user does not have access to the task (aka its list)" // @Failure 403 {object} web.HTTPError "The user does not have access to the task (aka its list)"
// @Failure 500 {object} models.Message "Internal error" // @Failure 500 {object} models.Message "Internal error"
// @Router /tasks/{id} [post] // @Router /tasks/{id} [post]
//
//nolint:gocyclo //nolint:gocyclo
func (t *Task) Update(s *xorm.Session, a web.Auth) (err error) { func (t *Task) Update(s *xorm.Session, a web.Auth) (err error) {

View file

@ -18,7 +18,7 @@ package gravatar
import ( import (
"context" "context"
"io/ioutil" "io"
"net/http" "net/http"
"strconv" "strconv"
"strings" "strings"
@ -74,7 +74,7 @@ func (g *Provider) GetAvatar(user *user.User, size int64) ([]byte, string, error
return nil, "", err return nil, "", err
} }
defer resp.Body.Close() defer resp.Body.Close()
avatarContent, err := ioutil.ReadAll(resp.Body) avatarContent, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return nil, "", err return nil, "", err
} }

View file

@ -20,13 +20,14 @@ import (
"bytes" "bytes"
"image" "image"
"image/png" "image/png"
"io/ioutil" "io"
"strconv" "strconv"
"code.vikunja.io/api/pkg/files" "code.vikunja.io/api/pkg/files"
"code.vikunja.io/api/pkg/log" "code.vikunja.io/api/pkg/log"
"code.vikunja.io/api/pkg/modules/keyvalue" "code.vikunja.io/api/pkg/modules/keyvalue"
"code.vikunja.io/api/pkg/user" "code.vikunja.io/api/pkg/user"
"github.com/disintegration/imaging" "github.com/disintegration/imaging"
) )
@ -82,7 +83,7 @@ func (p *Provider) GetAvatar(u *user.User, size int64) (avatar []byte, mimeType
return nil, "", err return nil, "", err
} }
avatar, err = ioutil.ReadAll(buf) avatar, err = io.ReadAll(buf)
if err != nil { if err != nil {
return nil, "", err return nil, "", err
} }

View file

@ -18,15 +18,14 @@ package migration
import ( import (
"bytes" "bytes"
"io/ioutil" "io"
"code.vikunja.io/api/pkg/modules/background/handler"
"xorm.io/xorm" "xorm.io/xorm"
"code.vikunja.io/api/pkg/db" "code.vikunja.io/api/pkg/db"
"code.vikunja.io/api/pkg/log" "code.vikunja.io/api/pkg/log"
"code.vikunja.io/api/pkg/models" "code.vikunja.io/api/pkg/models"
"code.vikunja.io/api/pkg/modules/background/handler"
"code.vikunja.io/api/pkg/user" "code.vikunja.io/api/pkg/user"
) )
@ -212,7 +211,7 @@ func insertFromStructure(s *xorm.Session, str []*models.NamespaceWithListsAndTas
// Check if we have a file to create // Check if we have a file to create
if len(a.File.FileContent) > 0 { if len(a.File.FileContent) > 0 {
a.TaskID = t.ID a.TaskID = t.ID
fr := ioutil.NopCloser(bytes.NewReader(a.File.FileContent)) fr := io.NopCloser(bytes.NewReader(a.File.FileContent))
err = a.NewAttachment(s, fr, a.File.Name, a.File.Size, user) err = a.NewAttachment(s, fr, a.File.Name, a.File.Size, user)
if err != nil { if err != nil {
return return

View file

@ -17,7 +17,7 @@
package todoist package todoist
import ( import (
"io/ioutil" "os"
"strconv" "strconv"
"testing" "testing"
"time" "time"
@ -47,7 +47,7 @@ func TestConvertTodoistToVikunja(t *testing.T) {
dueTimeWithTime = dueTimeWithTime.In(config.GetTimeZone()) dueTimeWithTime = dueTimeWithTime.In(config.GetTimeZone())
nilTime, err := time.Parse(time.RFC3339Nano, "0001-01-01T00:00:00Z") nilTime, err := time.Parse(time.RFC3339Nano, "0001-01-01T00:00:00Z")
assert.NoError(t, err) assert.NoError(t, err)
exampleFile, err := ioutil.ReadFile(config.ServiceRootpath.GetString() + "/pkg/modules/migration/wunderlist/testimage.jpg") exampleFile, err := os.ReadFile(config.ServiceRootpath.GetString() + "/pkg/modules/migration/wunderlist/testimage.jpg")
assert.NoError(t, err) assert.NoError(t, err)
makeTestItem := func(id, projectId int64, hasDueDate, hasLabels, done bool) *item { makeTestItem := func(id, projectId int64, hasDueDate, hasLabels, done bool) *item {

View file

@ -18,7 +18,7 @@ package trello
import ( import (
"bytes" "bytes"
"io/ioutil" "os"
"testing" "testing"
"time" "time"
@ -36,7 +36,7 @@ func TestConvertTrelloToVikunja(t *testing.T) {
time1, err := time.Parse(time.RFC3339Nano, "2014-09-26T08:25:05Z") time1, err := time.Parse(time.RFC3339Nano, "2014-09-26T08:25:05Z")
assert.NoError(t, err) assert.NoError(t, err)
exampleFile, err := ioutil.ReadFile(config.ServiceRootpath.GetString() + "/pkg/modules/migration/wunderlist/testimage.jpg") exampleFile, err := os.ReadFile(config.ServiceRootpath.GetString() + "/pkg/modules/migration/wunderlist/testimage.jpg")
assert.NoError(t, err) assert.NoError(t, err)
trelloData := []*trello.Board{ trelloData := []*trello.Board{

View file

@ -17,7 +17,7 @@
package wunderlist package wunderlist
import ( import (
"io/ioutil" "os"
"strconv" "strconv"
"testing" "testing"
"time" "time"
@ -46,7 +46,7 @@ func TestWunderlistParsing(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
time4 = time4.In(config.GetTimeZone()) time4 = time4.In(config.GetTimeZone())
exampleFile, err := ioutil.ReadFile(config.ServiceRootpath.GetString() + "/pkg/modules/migration/wunderlist/testimage.jpg") exampleFile, err := os.ReadFile(config.ServiceRootpath.GetString() + "/pkg/modules/migration/wunderlist/testimage.jpg")
assert.NoError(t, err) assert.NoError(t, err)
createTestTask := func(id, listID int, done bool) *task { createTestTask := func(id, listID int, done bool) *task {

View file

@ -19,7 +19,7 @@ package caldav
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"io/ioutil" "io"
"reflect" "reflect"
"strconv" "strconv"
"strings" "strings"
@ -61,9 +61,9 @@ func ListHandler(c echo.Context) error {
} }
// Try to parse a task from the request payload // Try to parse a task from the request payload
body, _ := ioutil.ReadAll(c.Request().Body) body, _ := io.ReadAll(c.Request().Body)
// Restore the io.ReadCloser to its original state // Restore the io.ReadCloser to its original state
c.Request().Body = ioutil.NopCloser(bytes.NewBuffer(body)) c.Request().Body = io.NopCloser(bytes.NewBuffer(body))
// Parse it // Parse it
vtodo := string(body) vtodo := string(body)
if vtodo != "" && strings.HasPrefix(vtodo, `BEGIN:VCALENDAR`) { if vtodo != "" && strings.HasPrefix(vtodo, `BEGIN:VCALENDAR`) {
@ -127,9 +127,9 @@ func PrincipalHandler(c echo.Context) error {
} }
// Try to parse a task from the request payload // Try to parse a task from the request payload
body, _ := ioutil.ReadAll(c.Request().Body) body, _ := io.ReadAll(c.Request().Body)
// Restore the io.ReadCloser to its original state // Restore the io.ReadCloser to its original state
c.Request().Body = ioutil.NopCloser(bytes.NewBuffer(body)) c.Request().Body = io.NopCloser(bytes.NewBuffer(body))
log.Debugf("[CALDAV] Request Body: %v\n", string(body)) log.Debugf("[CALDAV] Request Body: %v\n", string(body))
log.Debugf("[CALDAV] Request Headers: %v\n", c.Request().Header) log.Debugf("[CALDAV] Request Headers: %v\n", c.Request().Header)
@ -157,9 +157,9 @@ func EntryHandler(c echo.Context) error {
} }
// Try to parse a task from the request payload // Try to parse a task from the request payload
body, _ := ioutil.ReadAll(c.Request().Body) body, _ := io.ReadAll(c.Request().Body)
// Restore the io.ReadCloser to its original state // Restore the io.ReadCloser to its original state
c.Request().Body = ioutil.NopCloser(bytes.NewBuffer(body)) c.Request().Body = io.NopCloser(bytes.NewBuffer(body))
log.Debugf("[CALDAV] Request Body: %v\n", string(body)) log.Debugf("[CALDAV] Request Body: %v\n", string(body))
log.Debugf("[CALDAV] Request Headers: %v\n", c.Request().Header) log.Debugf("[CALDAV] Request Headers: %v\n", c.Request().Header)