From 1350330fe0da37655047c5d90ff2ac6d579ebf61 Mon Sep 17 00:00:00 2001 From: MetaCubeX Date: Fri, 18 Mar 2022 01:25:59 +0800 Subject: [PATCH] 1.fix module package 2.fix govet error --- config/config.go | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- log/log.go | 6 ++++++ rule/logic/common.go | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/config/config.go b/config/config.go index 902686f9a..f57f90ec0 100644 --- a/config/config.go +++ b/config/config.go @@ -604,7 +604,7 @@ func parseRules(cfg *RawConfig, proxies map[string]C.Proxy) ([]C.Rule, map[strin if ruleName == "GEOSITE" { if err := initGeoSite(); err != nil { - return nil, nil, fmt.Errorf("can't initial GeoSite: %w", err) + return nil, nil, fmt.Errorf("can't initial GeoSite: %s", err) } initMode = false } @@ -751,7 +751,7 @@ func parseFallbackGeoSite(countries []string, rules []C.Rule) ([]*router.DomainM var sites []*router.DomainMatcher if len(countries) > 0 { if err := initGeoSite(); err != nil { - return nil, fmt.Errorf("can't initial GeoSite: %w", err) + return nil, fmt.Errorf("can't initial GeoSite: %s", err) } } diff --git a/go.mod b/go.mod index e025839e4..615e6d4f3 100644 --- a/go.mod +++ b/go.mod @@ -57,4 +57,4 @@ require ( ) -replace golang.zx2c4.com/wintun v0.0.0-20211104114900-415007cec224 => github.com/MetaCubeX/wintun-go v0.0.0-20220317161916-5dcd44f3c355 +replace golang.zx2c4.com/wintun v0.0.0-20211104114900-415007cec224 => github.com/MetaCubeX/wintun-go v0.0.0-20220317182248-e32f9221663c diff --git a/go.sum b/go.sum index 19d85fcaf..cd1370ca5 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGy github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Dreamacro/go-shadowsocks2 v0.1.7 h1:8CtbE1HoPPMfrQZGXmlluq6dO2lL31W6WRRE8fabc4Q= github.com/Dreamacro/go-shadowsocks2 v0.1.7/go.mod h1:8p5G4cAj5ZlXwUR+Ww63gfSikr8kvw8uw3TDwLAJpUc= -github.com/MetaCubeX/wintun-go v0.0.0-20220317161916-5dcd44f3c355 h1:mbXCKCy+r8fUoDQh40CFy/lTKmcXpOnzzaFScy8EhRo= -github.com/MetaCubeX/wintun-go v0.0.0-20220317161916-5dcd44f3c355/go.mod h1:ARUuShAtcziEJ/vnZ2hgoP+zc0J7Ukcca2S/NPDoQCc= +github.com/MetaCubeX/wintun-go v0.0.0-20220317182248-e32f9221663c h1:fyg+AJU5BRmuEGeVexyABUiChIBeZ1UaER4DaV0jSLo= +github.com/MetaCubeX/wintun-go v0.0.0-20220317182248-e32f9221663c/go.mod h1:9ekUVS60VUdCP+s3E8TkAHmk04Wsu3DGU4Ruq8N7kaQ= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= diff --git a/log/log.go b/log/log.go index 3a7ea729b..4e5c375bd 100644 --- a/log/log.go +++ b/log/log.go @@ -97,3 +97,9 @@ func newLog(logLevel LogLevel, format string, v ...any) *Event { Payload: fmt.Sprintf(format, v...), } } + +func PrintLog(logLevel LogLevel, format string, v ...interface{}) { + event := newLog(logLevel, format, v...) + logCh <- event + print(event) +} diff --git a/rule/logic/common.go b/rule/logic/common.go index 9cc2bd9a4..d28cbc26a 100644 --- a/rule/logic/common.go +++ b/rule/logic/common.go @@ -58,7 +58,7 @@ func payloadToRule(subPayload string) (C.Rule, error) { } if tp == "GEOSITE" { if err := initGeoSite(); err != nil { - log.Errorln("can't initial GeoSite: %w", err) + log.Errorln("can't initial GeoSite: %s", err) } }