1
0

Add Golangci Lint (#676)

Increase golangci timeout

Fix installing golangci-lint in ci

Remove mage targets replaced by golangci

Run golint in ci

Add goheader linter

Enable & fix more linters

Fix lint issues

Add mage target to automagically fix issues found by golangci

golangci-lint run --fix

Add golangci config

Add golangci mage target

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/api/pulls/676
Co-Authored-By: konrad <konrad@kola-entertainments.de>
Co-Committed-By: konrad <konrad@kola-entertainments.de>
This commit is contained in:
konrad
2020-10-11 20:10:03 +00:00
parent d56a611be7
commit 699d3d6060
143 changed files with 630 additions and 426 deletions

View File

@ -18,18 +18,19 @@ package caldav
import (
"bytes"
"code.vikunja.io/api/pkg/log"
"code.vikunja.io/api/pkg/models"
"code.vikunja.io/api/pkg/user"
"code.vikunja.io/web/handler"
"fmt"
"github.com/labstack/echo/v4"
"github.com/samedi/caldav-go"
"github.com/samedi/caldav-go/lib"
"io/ioutil"
"reflect"
"strconv"
"strings"
"code.vikunja.io/api/pkg/log"
"code.vikunja.io/api/pkg/models"
"code.vikunja.io/api/pkg/user"
"code.vikunja.io/web/handler"
"github.com/labstack/echo/v4"
"github.com/samedi/caldav-go"
"github.com/samedi/caldav-go/lib"
)
func getBasicAuthUserFromContext(c echo.Context) (*user.User, error) {

View File

@ -17,14 +17,15 @@
package caldav
import (
"strconv"
"strings"
"time"
"code.vikunja.io/api/pkg/log"
"code.vikunja.io/api/pkg/models"
user2 "code.vikunja.io/api/pkg/user"
"github.com/samedi/caldav-go/data"
"github.com/samedi/caldav-go/errs"
"strconv"
"strings"
"time"
)
// DavBasePath is the base url path
@ -119,8 +120,8 @@ func (vcls *VikunjaCaldavListStorage) GetResourcesByList(rpaths []string) ([]dat
var uids []string
for _, path := range rpaths {
parts := strings.Split(path, "/")
uid := []rune(parts[4]) // The 4th part is the id with ".ics" suffix
endlen := len(uid) - 4 // ".ics" are 4 bytes
uid := []rune(parts[4]) // The 4th part is the id with ".ics" suffix
endlen := len(uid) - len(".ics") // ".ics" are 4 bytes
uids = append(uids, string(uid[:endlen]))
}
@ -174,7 +175,7 @@ func (vcls *VikunjaCaldavListStorage) GetResourcesByFilters(rpath string, filter
r.Name = vcls.list.Title
return []data.Resource{r}, nil
// For now, filtering is disabled.
//return vcls.GetResources(rpath, false)
// return vcls.GetResources(rpath, false)
}
func getTaskURL(task *models.Task) string {
@ -336,9 +337,9 @@ func (vlra *VikunjaListResourceAdapter) CalculateEtag() string {
// And therefore, updating the task fails since these etags don't match.
// To fix that, we use this extra field to determine if we're currently updating a task and return the
// etag of the list instead.
//if vlra.list != nil {
// return `"` + strconv.FormatInt(vlra.list.ID, 10) + `-` + strconv.FormatInt(vlra.list.Updated, 10) + `"`
//}
// if vlra.list != nil {
// return `"` + strconv.FormatInt(vlra.list.ID, 10) + `-` + strconv.FormatInt(vlra.list.Updated, 10) + `"`
// }
// Return the etag of a task if we have one
if vlra.task != nil {

View File

@ -17,12 +17,13 @@
package caldav
import (
"strconv"
"time"
"code.vikunja.io/api/pkg/caldav"
"code.vikunja.io/api/pkg/log"
"code.vikunja.io/api/pkg/models"
"github.com/laurent22/ical-go"
"strconv"
"time"
)
func getCaldavTodosForTasks(list *models.List) string {