autoresearch iter 10: keep error identity at the last errorlint sites

RunPushTest flattened channel validation failures with %v, telegram's
fallback path discarded the original send error, and the config loader's
type assertion on viper.ConfigFileNotFoundError would miss a wrapped form
and fatally abort over a merely missing file. errorlint now reports zero.
This commit is contained in:
ryan
2026-08-29 08:29:40 +08:00
parent f7fd980429
commit c4068efd54
3 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -6,6 +6,7 @@ package config
import (
"encoding/json"
"errors"
"flag"
"log"
"os"
@@ -67,7 +68,8 @@ func init() {
// 读取配置文件(可选:找不到文件时使用空默认值 + 环境变量)
if err := viper.ReadInConfig(); err != nil {
if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
var notFound viper.ConfigFileNotFoundError
if !errors.As(err, &notFound) {
// 文件存在但读取/解析失败
if _, statErr := os.Stat(configPath); statErr == nil { //nolint:gosec // configPath is loaded from CONFIG_PATH environment variable
log.Fatalf("[Config] read config failed: %v\n", err)