From 0d7eed46624b854bb8e1e541934a23ca9cc61e16 Mon Sep 17 00:00:00 2001 From: huangzw Date: Thu, 3 Apr 2025 17:01:34 +0800 Subject: [PATCH] perf(config/file): optimize file format func --- config/file/format.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/file/format.go b/config/file/format.go index 9e20e60b12a..6cce7d7b1b2 100644 --- a/config/file/format.go +++ b/config/file/format.go @@ -3,8 +3,8 @@ package file import "strings" func format(name string) string { - if p := strings.Split(name, "."); len(p) > 1 { - return p[len(p)-1] + if idx := strings.LastIndex(name, "."); idx >= 0 { + return name[idx+1:] } return "" }