1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-12-01 22:19:32 +02:00

Linter Cleanup (#276)

* linter cleanup

* fix default case
This commit is contained in:
3timeslazy
2019-03-29 17:48:51 +03:00
committed by Tim Voronov
parent 752ee02cd1
commit de703513e4
41 changed files with 408 additions and 147 deletions

View File

@@ -36,10 +36,7 @@ func Fmt(_ context.Context, args ...core.Value) (core.Value, error) {
}
func format(template string, args []core.Value) (string, error) {
rgx, err := regexp.Compile("{[0-9]*}")
if err != nil {
return "", errors.Errorf("failed to build regexp: %v", err)
}
rgx := regexp.MustCompile("{[0-9]*}")
argsCount := len(args)
emptyBracketsCount := strings.Count(template, "{}")
@@ -53,6 +50,7 @@ func format(template string, args []core.Value) (string, error) {
// index of the last value
// inserted into the template
var lastArgIdx int
var err error
template = rgx.ReplaceAllStringFunc(template, func(s string) string {
if err != nil {