summaryrefslogtreecommitdiffstats
path: root/modules/templates/helper.go
diff options
context:
space:
mode:
authorColin Arnott <carnott@snapchat.com>2019-10-15 21:24:16 +0000
committerzeripath <art27@cantab.net>2019-10-15 22:24:16 +0100
commit66e99d722a71d12b81264bc3577b85febe40e49e (patch)
tree99e4906ab068e35b393dbf7b941405127fd283fe /modules/templates/helper.go
parent80655026d2cc8e56223be546a5ed46634eafa059 (diff)
downloadgitea-66e99d722a71d12b81264bc3577b85febe40e49e.tar.gz
gitea-66e99d722a71d12b81264bc3577b85febe40e49e.zip
upgrade gopkg.in/editorconfig/editorconfig-core-go.v1 (#8501)
editorconfig-core-go made breaking api changes and has recently released v2.1.1. This change consumes the new api and fixes up any breaking references.
Diffstat (limited to 'modules/templates/helper.go')
-rw-r--r--modules/templates/helper.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index 2c53e05fca..9bb803c010 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -30,7 +30,7 @@ import (
"code.gitea.io/gitea/services/gitdiff"
mirror_service "code.gitea.io/gitea/services/mirror"
- "gopkg.in/editorconfig/editorconfig-core-go.v1"
+ "github.com/editorconfig/editorconfig-core-go/v2"
)
// NewFuncMap returns functions for injecting to templates
@@ -145,7 +145,11 @@ func NewFuncMap() []template.FuncMap {
},
"TabSizeClass": func(ec *editorconfig.Editorconfig, filename string) string {
if ec != nil {
- def := ec.GetDefinitionForFilename(filename)
+ def, err := ec.GetDefinitionForFilename(filename)
+ if err != nil {
+ log.Error("tab size class: getting definition for filename: %v", err)
+ return "tab-size-8"
+ }
if def.TabWidth > 0 {
return fmt.Sprintf("tab-size-%d", def.TabWidth)
}