From 66e99d722a71d12b81264bc3577b85febe40e49e Mon Sep 17 00:00:00 2001 From: Colin Arnott Date: Tue, 15 Oct 2019 21:24:16 +0000 Subject: 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. --- modules/templates/helper.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules/templates/helper.go') 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) } -- cgit v1.2.3