From 9c6ea109f89daec8cb47e83837f1b62b8ff2fe0a Mon Sep 17 00:00:00 2001 From: co63oc Date: Wed, 26 Jun 2024 19:47:39 +0800 Subject: [PATCH] Fix typos (#1053) --- pkg/cmd/hgctl/install.go | 2 +- pkg/ingress/config/ingress_config.go | 16 ++++++++-------- registry/consul/watcher.go | 4 ++-- registry/eureka/client/http_client.go | 6 +++--- registry/memory/cache.go | 4 ++-- registry/nacos/v2/watcher.go | 8 ++++---- registry/zookeeper/watcher.go | 8 ++++---- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pkg/cmd/hgctl/install.go b/pkg/cmd/hgctl/install.go index b772c749b..3a851ed14 100644 --- a/pkg/cmd/hgctl/install.go +++ b/pkg/cmd/hgctl/install.go @@ -175,7 +175,7 @@ func promptInstall(writer io.Writer, profileName string) bool { func promptProfileName(writer io.Writer) string { answer := "" - fmt.Fprintf(writer, "\nPlease select higress install configration profile:\n") + fmt.Fprintf(writer, "\nPlease select higress install configuration profile:\n") fmt.Fprintf(writer, "\n1.Install higress to local kubernetes cluster like kind etc.\n") fmt.Fprintf(writer, "\n2.Install higress to kubernetes cluster\n") fmt.Fprintf(writer, "\n3.Install higress to local docker environment\n") diff --git a/pkg/ingress/config/ingress_config.go b/pkg/ingress/config/ingress_config.go index 5aed5afda..3351fad72 100644 --- a/pkg/ingress/config/ingress_config.go +++ b/pkg/ingress/config/ingress_config.go @@ -918,7 +918,7 @@ func (m *IngressConfig) AddOrUpdateWasmPlugin(clusterNamespacedName util.Cluster Labels: map[string]string{constants.AlwaysPushLabel: "true"}, } for _, f := range m.wasmPluginHandlers { - IngressLog.Debug("WasmPlugin triggerd update") + IngressLog.Debug("WasmPlugin triggered update") f(config.Config{Meta: metadata}, config.Config{Meta: metadata}, model.EventUpdate) } istioWasmPlugin, err := m.convertIstioWasmPlugin(&wasmPlugin.Spec) @@ -960,7 +960,7 @@ func (m *IngressConfig) DeleteWasmPlugin(clusterNamespacedName util.ClusterNames Labels: map[string]string{constants.AlwaysPushLabel: "true"}, } for _, f := range m.wasmPluginHandlers { - IngressLog.Debug("WasmPlugin triggerd update") + IngressLog.Debug("WasmPlugin triggered update") f(config.Config{Meta: metadata}, config.Config{Meta: metadata}, model.EventDelete) } } @@ -987,7 +987,7 @@ func (m *IngressConfig) AddOrUpdateMcpBridge(clusterNamespacedName util.ClusterN Labels: map[string]string{constants.AlwaysPushLabel: "true"}, } for _, f := range m.serviceEntryHandlers { - IngressLog.Debug("McpBridge triggerd serviceEntry update") + IngressLog.Debug("McpBridge triggered serviceEntry update") f(config.Config{Meta: metadata}, config.Config{Meta: metadata}, model.EventUpdate) } }, m.localKubeClient, m.namespace) @@ -1042,7 +1042,7 @@ func (m *IngressConfig) AddOrUpdateHttp2Rpc(clusterNamespacedName util.ClusterNa } func (m *IngressConfig) DeleteHttp2Rpc(clusterNamespacedName util.ClusterNamespacedName) { - IngressLog.Infof("Http2Rpc triggerd deleted event %s", clusterNamespacedName.Name) + IngressLog.Infof("Http2Rpc triggered deleted event %s", clusterNamespacedName.Name) if clusterNamespacedName.Namespace != m.namespace { return } @@ -1054,7 +1054,7 @@ func (m *IngressConfig) DeleteHttp2Rpc(clusterNamespacedName util.ClusterNamespa } m.mutex.Unlock() if hit { - IngressLog.Infof("Http2Rpc triggerd deleted event executed %s", clusterNamespacedName.Name) + IngressLog.Infof("Http2Rpc triggered deleted event executed %s", clusterNamespacedName.Name) push := func(kind config.GroupVersionKind) { m.XDSUpdater.ConfigUpdate(&model.PushRequest{ Full: true, @@ -1160,13 +1160,13 @@ func (m *IngressConfig) constructHttp2RpcEnvoyFilter(http2rpcConfig *annotations IngressLog.Infof("Found http2rpc mappings %v", mappings) if _, exist := mappings[http2rpcConfig.Name]; !exist { IngressLog.Errorf("Http2RpcConfig name %s, not found Http2Rpc CRD", http2rpcConfig.Name) - return nil, errors.New("invalid http2rpcConfig has no useable http2rpc") + return nil, errors.New("invalid http2rpcConfig has no usable http2rpc") } http2rpcCRD := mappings[http2rpcConfig.Name] if http2rpcCRD.GetDubbo() == nil { IngressLog.Errorf("Http2RpcConfig name %s, only support Http2Rpc CRD Dubbo Service type", http2rpcConfig.Name) - return nil, errors.New("invalid http2rpcConfig has no useable http2rpc") + return nil, errors.New("invalid http2rpcConfig has no usable http2rpc") } httpRoute := route.HTTPRoute @@ -1293,7 +1293,7 @@ func (m *IngressConfig) constructHttp2RpcMethods(dubbo *higressv1.DubboService) var method = make(map[string]interface{}) method["name"] = serviceMethod.GetServiceMethod() var params []interface{} - // paramFromEntireBody is for methods with single parameter. So when paramFromEntireBody exists, we just ignore parmas. + // paramFromEntireBody is for methods with single parameter. So when paramFromEntireBody exists, we just ignore params. var paramFromEntireBody = serviceMethod.GetParamFromEntireBody() if paramFromEntireBody != nil { var param = make(map[string]interface{}) diff --git a/registry/consul/watcher.go b/registry/consul/watcher.go index 2dca6303f..ededd3a71 100644 --- a/registry/consul/watcher.go +++ b/registry/consul/watcher.go @@ -31,7 +31,7 @@ import ( ) const ( - ConuslHealthPassing = "passing" + ConsulHealthPassing = "passing" DefaultRefreshInterval = time.Second * 30 DefaultRefreshIntervalLimit = time.Second * 10 ) @@ -315,7 +315,7 @@ func (w *watcher) generateServiceEntry(host string, services []*consulapi.Servic for _, service := range services { // service status: maintenance > critical > warning > passing - if service.Checks.AggregatedStatus() != ConuslHealthPassing { + if service.Checks.AggregatedStatus() != ConsulHealthPassing { continue } diff --git a/registry/eureka/client/http_client.go b/registry/eureka/client/http_client.go index 5a7a44e86..820313007 100644 --- a/registry/eureka/client/http_client.go +++ b/registry/eureka/client/http_client.go @@ -42,7 +42,7 @@ func NewEurekaHttpClient(config EurekaHttpConfig) EurekaHttpClient { type EurekaHttpConfig struct { BaseUrl string ConnectTimeoutSeconds int // default 30 - PollInterval int //default 30 + PollInterval int // default 30 Retries int // default 3 RetryDelayTime int // default 100ms EnableDelta bool @@ -101,7 +101,7 @@ func (e *eurekaHttpClient) ScheduleAppUpdates(name string, stop <-chan struct{}) func (e *eurekaHttpClient) GetDelta() (*Applications, error) { if !e.EnableDelta { - return nil, fmt.Errorf("failed to get DeltaAppliation, enableDelta is false") + return nil, fmt.Errorf("failed to get DeltaApplication, enableDelta is false") } return e.getApplications("/apps/delta") } @@ -119,7 +119,7 @@ func (c *eurekaHttpClient) getApplications(path string) (*Applications, error) { var rj fargo.GetAppsResponseJson if err = json.Unmarshal(res, &rj); err != nil { - log.Errorf("Failed to unmarshal response body to fargo.GetAppResponseJosn, error: %v", err) + log.Errorf("Failed to unmarshal response body to fargo.GetAppResponseJson, error: %v", err) return nil, err } diff --git a/registry/memory/cache.go b/registry/memory/cache.go index 9df0e31dd..c0cacf749 100644 --- a/registry/memory/cache.go +++ b/registry/memory/cache.go @@ -30,7 +30,7 @@ type Cache interface { UpdateServiceEntryWrapper(service string, data *ServiceEntryWrapper) DeleteServiceEntryWrapper(service string) PurgeStaleService() - UpdateServiceEntryEnpointWrapper(service, ip, regionId, zoneId, protocol string, labels map[string]string) + UpdateServiceEntryEndpointWrapper(service, ip, regionId, zoneId, protocol string, labels map[string]string) GetServiceByEndpoints(requestVersions, endpoints map[string]bool, versionKey string, protocol common.Protocol) map[string][]string GetAllServiceEntry() []*v1alpha3.ServiceEntry GetAllServiceEntryWrapper() []*ServiceEntryWrapper @@ -58,7 +58,7 @@ type store struct { deferedDelete map[string]struct{} } -func (s *store) UpdateServiceEntryEnpointWrapper(service, ip, regionId, zoneId, protocol string, labels map[string]string) { +func (s *store) UpdateServiceEntryEndpointWrapper(service, ip, regionId, zoneId, protocol string, labels map[string]string) { s.mux.Lock() defer s.mux.Unlock() if se, exist := s.sew[service]; exist { diff --git a/registry/nacos/v2/watcher.go b/registry/nacos/v2/watcher.go index 5ce3ef00f..e04c1ec7d 100644 --- a/registry/nacos/v2/watcher.go +++ b/registry/nacos/v2/watcher.go @@ -66,7 +66,7 @@ type watcher struct { isStop bool addrProvider *address.NacosAddressProvider updateCacheWhenEmpty bool - nacosClietConfig *constant.ClientConfig + nacosClientConfig *constant.ClientConfig authOption provider.AuthOption } @@ -94,7 +94,7 @@ func NewWatcher(cache memory.Cache, opts ...WatcherOption) (provider.Watcher, er log.Infof("new nacos2 watcher with config Name:%s", w.Name) - w.nacosClietConfig = constant.NewClientConfig( + w.nacosClientConfig = constant.NewClientConfig( constant.WithTimeoutMs(DefaultNacosTimeout), constant.WithLogLevel(DefaultNacosLogLevel), constant.WithLogDir(DefaultNacosLogDir), @@ -129,7 +129,7 @@ func NewWatcher(cache memory.Cache, opts ...WatcherOption) (provider.Watcher, er success := make(chan struct{}) go func() { namingClient, err := clients.NewNamingClient(vo.NacosClientParam{ - ClientConfig: w.nacosClietConfig, + ClientConfig: w.nacosClientConfig, ServerConfigs: sc, }) if err == nil { @@ -267,7 +267,7 @@ func (w *watcher) updateNacosClient() { defer w.mutex.Unlock() w.Domain = addr namingClient, err := clients.NewNamingClient(vo.NacosClientParam{ - ClientConfig: w.nacosClietConfig, + ClientConfig: w.nacosClientConfig, ServerConfigs: []constant.ServerConfig{ *constant.NewServerConfig(addr, uint64(w.Port)), }, diff --git a/registry/zookeeper/watcher.go b/registry/zookeeper/watcher.go index 6f8f69bbb..32f4d42e2 100644 --- a/registry/zookeeper/watcher.go +++ b/registry/zookeeper/watcher.go @@ -241,7 +241,7 @@ func (w *watcher) fetchAllServices(firstFetch ...bool) error { case SpringCloudService: serviceConfig.UrlIndex = path.Join(serviceInfo.rootPath, serviceInfo.service) default: - return errors.New("unkown type") + return errors.New("unknown type") } serviceConfigs = append(serviceConfigs, serviceConfig) } @@ -275,7 +275,7 @@ func (w *watcher) ListenService() { } log.Errorf("[Zookeeper][ListenService] Get children of path zkRootPath with watcher failed, err:%v, index:%s", err, listIndex.UrlIndex) - // May be the provider does not ready yet, sleep failTimes * ConnDelay senconds to wait + // May be the provider does not ready yet, sleep failTimes * ConnDelay seconds to wait after := time.After(timeSecondDuration(failTimes * ConnDelay)) select { case <-after: @@ -384,7 +384,7 @@ func (w *watcher) GetInterfaceConfig(event Event) (string, *InterfaceConfig, err } } -func (w *watcher) GetSpringCloudConfig(intefaceName string, content []byte) (string, *InterfaceConfig, error) { +func (w *watcher) GetSpringCloudConfig(interfaceName string, content []byte) (string, *InterfaceConfig, error) { var instance SpringCloudInstance err := json.Unmarshal(content, &instance) if err != nil { @@ -392,7 +392,7 @@ func (w *watcher) GetSpringCloudConfig(intefaceName string, content []byte) (str return "", nil, err } var config InterfaceConfig - host := intefaceName + host := interfaceName config.Host = host config.Protocol = common.HTTP.String() if len(instance.Payload.Metadata) > 0 && instance.Payload.Metadata["protocol"] != "" {