From 76b87b1bbd9dcbb1adf0192b1168905565fea774 Mon Sep 17 00:00:00 2001 From: Yoan Blanc Date: Wed, 25 Dec 2019 03:26:57 +0100 Subject: repo: use editorconfig v2 (#5888) * repo: editorconfig v2 Signed-off-by: Yoan Blanc * fixup! repo: editorconfig v2 Signed-off-by: Yoan Blanc * Update repo.go * Update repo.go Co-authored-by: Unknwon --- internal/template/template.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'internal/template') diff --git a/internal/template/template.go b/internal/template/template.go index abbf416e..bbe0d2a0 100644 --- a/internal/template/template.go +++ b/internal/template/template.go @@ -14,12 +14,12 @@ import ( "strings" "time" + "github.com/editorconfig/editorconfig-core-go/v2" jsoniter "github.com/json-iterator/go" "github.com/microcosm-cc/bluemonday" "golang.org/x/net/html/charset" "golang.org/x/text/transform" log "gopkg.in/clog.v1" - "gopkg.in/editorconfig/editorconfig-core-go.v1" "gogs.io/gogs/internal/db" "gogs.io/gogs/internal/markup" @@ -116,8 +116,8 @@ func NewFuncMap() []template.FuncMap { }, "TabSizeClass": func(ec *editorconfig.Editorconfig, filename string) string { if ec != nil { - def := ec.GetDefinitionForFilename(filename) - if def.TabWidth > 0 { + def, err := ec.GetDefinitionForFilename(filename) + if err == nil && def.TabWidth > 0 { return fmt.Sprintf("tab-size-%d", def.TabWidth) } } -- cgit v1.2.3