diff options
author | Yoan Blanc <yoan@dosimple.ch> | 2019-12-25 03:26:57 +0100 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2019-12-25 10:26:57 +0800 |
commit | 76b87b1bbd9dcbb1adf0192b1168905565fea774 (patch) | |
tree | 35ab1e30bc0131ca4810f1dd2ad2025fdeb657db /internal/template | |
parent | 1b929e3afce638b808c30074ec0461c72e636abc (diff) |
repo: use editorconfig v2 (#5888)
* repo: editorconfig v2
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
* fixup! repo: editorconfig v2
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
* Update repo.go
* Update repo.go
Co-authored-by: Unknwon <u@gogs.io>
Diffstat (limited to 'internal/template')
-rw-r--r-- | internal/template/template.go | 6 |
1 files changed, 3 insertions, 3 deletions
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) } } |