From 9431d5020dcf334e4a61542ff0613f5037524ab6 Mon Sep 17 00:00:00 2001 From: mutezebra Date: Sun, 12 Jan 2025 11:49:49 +0800 Subject: [PATCH] fix: fix license --- configcenter/nacos_load_test.go | 17 +++++++++++++++++ pkg/cmd/gateway.go | 9 --------- pkg/common/yaml/yaml.go | 2 +- pkg/config/config_load.go | 4 ++++ pkg/config/xds/lds.go | 2 +- pkg/logger/logger.go | 2 -- pkg/server/listener_manager.go | 2 +- 7 files changed, 24 insertions(+), 14 deletions(-) diff --git a/configcenter/nacos_load_test.go b/configcenter/nacos_load_test.go index e59032251..39d13c15e 100644 --- a/configcenter/nacos_load_test.go +++ b/configcenter/nacos_load_test.go @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package configcenter import ( diff --git a/pkg/cmd/gateway.go b/pkg/cmd/gateway.go index 668286717..34b383a76 100644 --- a/pkg/cmd/gateway.go +++ b/pkg/cmd/gateway.go @@ -111,29 +111,22 @@ type DefaultDeployer struct { } func (d *DefaultDeployer) initialize() error { - logger.Info("initialize") err := initLog() if err != nil { logger.Warnf("[startGatewayCmd] failed to init logger, %s", err.Error()) } - logger.Info("initialize log success") // load Bootstrap config d.bootstrap = d.configManger.LoadBootConfig(configPath) - logger.Infof("init boot success") initLogWithConfig(d.bootstrap) - fmt.Println("emmm") - logger.Infof("init log success") err = initLimitCpus() if err != nil { logger.Errorf("[startCmd] failed to get limit cpu number, %s", err.Error()) } - logger.Infof("init cpu ?") hotreload.StartHotReload(d.configManger, d.bootstrap) - logger.Infof("have started") return err } @@ -194,9 +187,7 @@ func initLog() error { func initLogWithConfig(boot *model.Bootstrap) { if boot.Log != nil { - fmt.Println("start") logger.InitLogger(boot.Log.Build()) - fmt.Println("end") } } diff --git a/pkg/common/yaml/yaml.go b/pkg/common/yaml/yaml.go index 72a35f036..2f6281d53 100644 --- a/pkg/common/yaml/yaml.go +++ b/pkg/common/yaml/yaml.go @@ -25,7 +25,7 @@ import ( import ( perrors "github.com/pkg/errors" - "gopkg.in/yaml.v3" + "gopkg.in/yaml.v2" ) // LoadYMLConfig Load yml config byte from file diff --git a/pkg/config/config_load.go b/pkg/config/config_load.go index 64cda0764..25fcae135 100644 --- a/pkg/config/config_load.go +++ b/pkg/config/config_load.go @@ -255,6 +255,10 @@ func (m *ConfigManager) loadRemoteBootConfigs() *model.Bootstrap { // ViewRemoteConfig returns the current remote configuration. func (m *ConfigManager) ViewRemoteConfig() *model.Bootstrap { + if m.load == nil { + return nil + } + return m.load.ViewRemoteConfig() } diff --git a/pkg/config/xds/lds.go b/pkg/config/xds/lds.go index c53058cfc..cc455d129 100644 --- a/pkg/config/xds/lds.go +++ b/pkg/config/xds/lds.go @@ -24,7 +24,7 @@ import ( import ( xdsModel "github.com/dubbo-go-pixiu/pixiu-api/pkg/xds/model" - "gopkg.in/yaml.v3" + "gopkg.in/yaml.v2" ) import ( diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go index 283f12bc0..9fd73af1e 100644 --- a/pkg/logger/logger.go +++ b/pkg/logger/logger.go @@ -19,7 +19,6 @@ package logger import ( "fmt" - "log" "os" "path" ) @@ -79,7 +78,6 @@ func InitLog(logConfFile string) error { } func InitLogger(conf *zap.Config) { - log.Println("yes start") var zapLoggerConfig zap.Config if conf == nil { zapLoggerConfig = zap.NewDevelopmentConfig() diff --git a/pkg/server/listener_manager.go b/pkg/server/listener_manager.go index 89e8a463d..1cdccda4b 100644 --- a/pkg/server/listener_manager.go +++ b/pkg/server/listener_manager.go @@ -28,7 +28,7 @@ import ( import ( "github.com/pkg/errors" - "gopkg.in/yaml.v3" + "gopkg.in/yaml.v2" ) import (