This is an automated email from the ASF dual-hosted git repository.
xuetaoli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git
The following commit(s) were added to refs/heads/main by this push:
new e9d57879 Update CI version (#1054)
e9d57879 is described below
commit e9d57879f34edc730aff8c687e68ae9321235230
Author: Xuetao Li <[email protected]>
AuthorDate: Mon Mar 16 14:22:22 2026 +0800
Update CI version (#1054)
---
.github/workflows/github-actions.yml | 10 +-
.github/workflows/golangci-lint.yml | 14 +--
.golangci.yml | 122 ++++++++++++++-------
book-flight-ai-agent/go-client/cmd/client.go | 6 +-
book-flight-ai-agent/go-server/agents/cot_agent.go | 6 +-
book-flight-ai-agent/go-server/agents/task.go | 2 +-
.../go-server/model/ollama/ollama.go | 21 ++--
config_center/nacos/go-client/cmd/main.go | 5 +-
config_center/nacos/go-server/cmd/main.go | 5 +-
config_center/zookeeper/go-client/cmd/main.go | 6 +-
config_center/zookeeper/go-server/cmd/main.go | 6 +-
filter/polaris/limit/go-client/cmd/main.go | 12 +-
filter/sentinel/go-server/cmd/main.go | 17 ---
filter/tpslimit/go-server/pkg/reject_handler.go | 2 +-
llm/config/config.go | 4 +-
llm/go-client/cmd/client.go | 2 +-
llm/go-client/frontend/handlers/chat.go | 10 +-
llm/go-server/cmd/server.go | 10 +-
llm/go-server/llm/llm_service.go | 6 +-
metrics/go-server/cmd/main.go | 7 +-
router/tag/go-client/cmd/client.go | 20 +---
21 files changed, 149 insertions(+), 144 deletions(-)
diff --git a/.github/workflows/github-actions.yml
b/.github/workflows/github-actions.yml
index 75e08549..6d3dddac 100644
--- a/.github/workflows/github-actions.yml
+++ b/.github/workflows/github-actions.yml
@@ -54,10 +54,6 @@ jobs:
run: |
command -v imports-formatter >/dev/null 2>&1 || go install
github.com/dubbogo/tools/cmd/imports-formatter@latest
- - name: Get dependencies
- run: |
- go mod tidy
-
- name: Format code
run: |
go fmt ./...
@@ -65,9 +61,6 @@ jobs:
git status
[[ -z "$(git status -s)" ]]
- - name: Check license header
- uses: apache/skywalking-eyes/header@main
-
- name: Switch Dubbo-go version
shell: bash
run: |
@@ -84,6 +77,9 @@ jobs:
go mod edit
-replace=dubbo.apache.org/dubbo-go/v3=dubbo.apache.org/dubbo-go/v3@$BRANCH
go mod tidy
+ - name: Check license header
+ uses: apache/skywalking-eyes/header@main
+
- name: Integration test
run: |
chmod +x start_integrate_test.sh
diff --git a/.github/workflows/golangci-lint.yml
b/.github/workflows/golangci-lint.yml
index 235744bd..38814e34 100644
--- a/.github/workflows/golangci-lint.yml
+++ b/.github/workflows/golangci-lint.yml
@@ -18,20 +18,17 @@ jobs:
pull-requests: read # for golangci/golangci-lint-action to fetch pull
requests
name: lint
runs-on: ubuntu-latest
- strategy:
- matrix:
- go-version:
- - '1.25'
steps:
- - uses: actions/setup-go@v5
+ - uses: actions/checkout@v5
+
+ - uses: actions/setup-go@v6
with:
- go-version: ${{ matrix.go-version }}
+ go-version-file: go.mod
cache: true
cache-dependency-path: |
**/go.mod
**/go.sum
- - uses: actions/checkout@v4
- name: Switch Dubbo-go version
run: |
@@ -49,8 +46,9 @@ jobs:
go mod edit
-replace=dubbo.apache.org/dubbo-go/v3=dubbo.apache.org/dubbo-go/v3@$BRANCH
go mod tidy
+
- name: golangci-lint
- uses: golangci/golangci-lint-action@v6
+ uses: golangci/golangci-lint-action@v9
with:
version: latest
args: --timeout=10m
diff --git a/.golangci.yml b/.golangci.yml
index e6f5dd00..63d9fb04 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -1,46 +1,86 @@
-linters-settings:
- gocyclo:
- min-complexity: 10
- dupl:
- threshold: 100
- goconst:
- min-len: 2
- min-occurrences: 2
- depguard:
- rules:
- main:
- deny:
- - pkg: "github.com/sirupsen/logrus"
- desc: logging is allowed only by logutils.Log, logrus, is allowed
to use only in logutils package
- lll:
- line-length: 140
- goimports:
- local-prefixes: github.com/golangci/golangci-lint
- gocritic:
- enabled-tags:
- - performance
- - style
- - experimental
- disabled-checks:
- - wrapperFunc
+# 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.
+version: "2"
linters:
- disable-all: true
+ default: none
enable:
- - staticcheck
+ - govet
- ineffassign
- misspell
-
-issues:
- exclude-dirs:
- - test/testdata_etc
- - pkg/golinters/goanalysis/(checker|passes)
- exclude-rules:
- - text: "weak cryptographic primitive"
- linters:
- - gosec
- - linters:
- - staticcheck
- text: "SA1019:"
-
-
+ - staticcheck
+ - unused
+ - testifylint
+ settings:
+ depguard:
+ rules:
+ main:
+ deny:
+ - pkg: github.com/sirupsen/logrus
+ desc: logging is allowed only by logutils.Log, logrus is allowed
to use only in logutils package
+ dupl:
+ threshold: 100
+ goconst:
+ min-len: 2
+ min-occurrences: 2
+ gocritic:
+ disabled-checks:
+ - wrapperFunc
+ enabled-tags:
+ - performance
+ - style
+ - experimental
+ gocyclo:
+ min-complexity: 10
+ govet:
+ enable:
+ - shadow
+ lll:
+ line-length: 140
+ misspell:
+ locale: US
+ ignore-rules:
+ - nto
+ exclusions:
+ generated: lax
+ presets:
+ - comments
+ - common-false-positives
+ - legacy
+ - std-error-handling
+ rules:
+ - linters:
+ - gosec
+ text: weak cryptographic primitive
+ - linters:
+ - staticcheck
+ text: '(SA1019|ST1001):'
+ paths:
+ - test/testdata_etc
+ - pkg/golinters/goanalysis/(checker|passes)
+ - third_party$
+ - builtin$
+ - examples$
+formatters:
+ settings:
+ goimports:
+ local-prefixes:
+ - github.com/golangci/golangci-lint
+ exclusions:
+ generated: lax
+ paths:
+ - third_party$
+ - builtin$
+ - examples$
\ No newline at end of file
diff --git a/book-flight-ai-agent/go-client/cmd/client.go
b/book-flight-ai-agent/go-client/cmd/client.go
index ea6a84ce..114c44fe 100644
--- a/book-flight-ai-agent/go-client/cmd/client.go
+++ b/book-flight-ai-agent/go-client/cmd/client.go
@@ -68,20 +68,20 @@ func handleCommand(cmd string) (resp string) {
case cmd == "/list":
fmt.Println("Stored contexts (max 3):")
for _, ctxID := range contextOrder {
- respBuilder.WriteString(fmt.Sprintf("- %s\n", ctxID))
+ fmt.Fprintf(&respBuilder, "- %s\n", ctxID)
}
case strings.HasPrefix(cmd, "/cd "):
target := strings.TrimPrefix(cmd, "/cd ")
if ctx, exists := contexts[target]; exists {
currentCtxID = ctx.ID
- respBuilder.WriteString(fmt.Sprintf("Switched to
context: %s\n", target))
+ fmt.Fprintf(&respBuilder, "Switched to context: %s\n",
target)
} else {
respBuilder.WriteString("Context not found")
}
case cmd == "/new":
newID := createContext()
currentCtxID = newID
- respBuilder.WriteString(fmt.Sprintf("Created new context:
%s\n", newID))
+ fmt.Fprintf(&respBuilder, "Created new context: %s\n", newID)
default:
respBuilder.WriteString("Available commands:\n")
respBuilder.WriteString("/? help - Show this help\n")
diff --git a/book-flight-ai-agent/go-server/agents/cot_agent.go
b/book-flight-ai-agent/go-server/agents/cot_agent.go
index abec7639..9cb42936 100644
--- a/book-flight-ai-agent/go-server/agents/cot_agent.go
+++ b/book-flight-ai-agent/go-server/agents/cot_agent.go
@@ -121,10 +121,10 @@ func (react *ReactAgentRunner) GetInputCtx(input string)
string {
var respBuilder strings.Builder // Use strings.Builder
for _, msg := range react.memoryAgent {
if val, ok := msg["user"]; ok {
- respBuilder.WriteString(fmt.Sprintf("\n%v", val))
+ fmt.Fprintf(&respBuilder, "\n%v", val)
}
}
- respBuilder.WriteString(fmt.Sprintf("\n%v", input))
+ fmt.Fprintf(&respBuilder, "\n%v", input)
return strings.TrimSpace(respBuilder.String())
}
@@ -195,7 +195,7 @@ func (react *ReactAgentRunner) finalStep(
func (react *ReactAgentRunner) execAction(action actions.Action, opts
model.Options) string {
var err error
- var observation string = fmt.Sprintf("Can't find tool: %v.",
action.Method)
+ observation := fmt.Sprintf("Can't find tool: %v.", action.Method)
tool := react.tools.QueryTool(action.Method)
if tool != nil {
strArgs, _ := json.Marshal(action.Params)
diff --git a/book-flight-ai-agent/go-server/agents/task.go
b/book-flight-ai-agent/go-server/agents/task.go
index dc40809e..85ce5c0b 100644
--- a/book-flight-ai-agent/go-server/agents/task.go
+++ b/book-flight-ai-agent/go-server/agents/task.go
@@ -71,7 +71,7 @@ func CreateToolkitByVariadic(description string, taskFlag
TaskState, ts ...tools
// CreateToolkit
func CreateToolkit(description string, taskFlag TaskState, ts []tools.Tool)
tools.Tools {
- var toolsTask []tools.Tool = ts
+ toolsTask := ts
if taskFlag&TaskSubmitted != 0 {
if t, err :=
tools.CreateTool[TaskSubmittedTool]("TaskSubmitted", "任务已提交", ""); err == nil {
toolsTask = append(toolsTask, t)
diff --git a/book-flight-ai-agent/go-server/model/ollama/ollama.go
b/book-flight-ai-agent/go-server/model/ollama/ollama.go
index b583a32f..5aa68bc8 100644
--- a/book-flight-ai-agent/go-server/model/ollama/ollama.go
+++ b/book-flight-ai-agent/go-server/model/ollama/ollama.go
@@ -77,19 +77,14 @@ Options:
num_thread:
*/
type LLMOllama struct {
- llmUrl LLMUrl
- Model string
- Url string
- Prompt string
- stream *bool
- suffix string
- images []ImageData
- format string
- system string
- template string
- raw bool
- keepAlive string
- options []any
+ llmUrl LLMUrl
+ Model string
+ Url string
+ Prompt string
+ stream *bool
+ suffix string
+ images []ImageData
+ system string
}
func NewLLMOllama(model string, url string) *LLMOllama {
diff --git a/config_center/nacos/go-client/cmd/main.go
b/config_center/nacos/go-client/cmd/main.go
index 5b925de5..73643080 100644
--- a/config_center/nacos/go-client/cmd/main.go
+++ b/config_center/nacos/go-client/cmd/main.go
@@ -77,14 +77,15 @@ func main() {
panic(err)
}
- if err := publishAndWaitConfig(
+ err = publishAndWaitConfig(
configClient,
"dubbo-go-samples-configcenter-nacos-go-client",
"dubbo",
configCenterNacosClientConfig,
10*time.Second,
200*time.Millisecond,
- ); err != nil {
+ )
+ if err != nil {
panic(err)
}
diff --git a/config_center/nacos/go-server/cmd/main.go
b/config_center/nacos/go-server/cmd/main.go
index 1fb6284a..53a0dbdb 100644
--- a/config_center/nacos/go-server/cmd/main.go
+++ b/config_center/nacos/go-server/cmd/main.go
@@ -89,14 +89,15 @@ func main() {
panic(err)
}
- if err := publishAndWaitConfig(
+ err = publishAndWaitConfig(
configClient,
"dubbo-go-samples-configcenter-nacos-go-server",
"dubbo",
configCenterNacosServerConfig,
10*time.Second,
200*time.Millisecond,
- ); err != nil {
+ )
+ if err != nil {
panic(err)
}
diff --git a/config_center/zookeeper/go-client/cmd/main.go
b/config_center/zookeeper/go-client/cmd/main.go
index 69fb2384..c499645e 100644
--- a/config_center/zookeeper/go-client/cmd/main.go
+++ b/config_center/zookeeper/go-client/cmd/main.go
@@ -104,7 +104,8 @@ func writeRuleToConfigCenter() error {
}
// create parent paths
- if err := createParentPaths(c, path); err != nil {
+ err = createParentPaths(c, path)
+ if err != nil {
return perrors.Wrap(err, "failed to create parent paths")
}
@@ -129,7 +130,8 @@ func writeRuleToConfigCenter() error {
logger.Info("Created new config node")
}
- if err := waitForConfigReady(c, path, valueBytes, 10*time.Second); err
!= nil {
+ err = waitForConfigReady(c, path, valueBytes, 10*time.Second)
+ if err != nil {
return perrors.Wrap(err, "wait for config ready")
}
diff --git a/config_center/zookeeper/go-server/cmd/main.go
b/config_center/zookeeper/go-server/cmd/main.go
index c8b2b0df..18071019 100644
--- a/config_center/zookeeper/go-server/cmd/main.go
+++ b/config_center/zookeeper/go-server/cmd/main.go
@@ -123,7 +123,8 @@ func writeRuleToConfigCenter() error {
}
// Create parent paths
- if err := createParentPaths(c, path); err != nil {
+ err = createParentPaths(c, path)
+ if err != nil {
return perrors.Wrap(err, "failed to create parent paths")
}
@@ -148,7 +149,8 @@ func writeRuleToConfigCenter() error {
logger.Info("Created new configuration in config center")
}
- if err := waitForConfigReady(c, path, valueBytes, 10*time.Second); err
!= nil {
+ err = waitForConfigReady(c, path, valueBytes, 10*time.Second)
+ if err != nil {
return perrors.Wrap(err, "wait for config ready")
}
diff --git a/filter/polaris/limit/go-client/cmd/main.go
b/filter/polaris/limit/go-client/cmd/main.go
index 2b8922d6..615d8876 100644
--- a/filter/polaris/limit/go-client/cmd/main.go
+++ b/filter/polaris/limit/go-client/cmd/main.go
@@ -55,8 +55,8 @@ func main() {
for i := 0; i < 10; i++ {
time.Sleep(50 * time.Millisecond)
- user, err := svc.Greet(context.Background(),
&greet.GreetRequest{Name: "hello world"})
- if err != nil {
+ user, callErr := svc.Greet(context.Background(),
&greet.GreetRequest{Name: "hello world"})
+ if callErr != nil {
failCount++
continue
}
@@ -66,7 +66,7 @@ func main() {
}
logger.Infof("successCount=%v, failCount=%v\n", successCount, failCount)
- if !(successCount == 1 && failCount == 9) {
+ if successCount != 1 || failCount != 9 {
panic("ratelimit expect 1 success and 9 fail")
}
@@ -84,8 +84,8 @@ func main() {
for i := 0; i < 10; i++ {
time.Sleep(50 * time.Millisecond)
- user, err := svc.Greet(context.Background(),
&greet.GreetRequest{Name: "hello world"})
- if err != nil {
+ user, callErr := svc.Greet(context.Background(),
&greet.GreetRequest{Name: "hello world"})
+ if callErr != nil {
failCount++
continue
}
@@ -95,7 +95,7 @@ func main() {
}
logger.Infof("successCount=%v, failCount=%v\n", successCount, failCount)
- if !(successCount == 10 && failCount == 0) {
+ if successCount != 10 || failCount != 0 {
panic("ratelimit expect 10 success and 0 fail")
}
}
diff --git a/filter/sentinel/go-server/cmd/main.go
b/filter/sentinel/go-server/cmd/main.go
index bfe1f6c4..e75b0162 100644
--- a/filter/sentinel/go-server/cmd/main.go
+++ b/filter/sentinel/go-server/cmd/main.go
@@ -29,10 +29,8 @@ import (
"dubbo.apache.org/dubbo-go/v3/protocol"
"dubbo.apache.org/dubbo-go/v3/server"
- "github.com/alibaba/sentinel-golang/core/circuitbreaker"
"github.com/alibaba/sentinel-golang/core/flow"
"github.com/alibaba/sentinel-golang/core/isolation"
- "github.com/alibaba/sentinel-golang/util"
"github.com/dubbogo/gost/log/logger"
@@ -43,21 +41,6 @@ import (
greet "github.com/apache/dubbo-go-samples/filter/proto/sentinel"
)
-type stateChangeTestListener struct {
-}
-
-func (s *stateChangeTestListener) OnTransformToClosed(prev
circuitbreaker.State, rule circuitbreaker.Rule) {
- logger.Infof("rule.steategy: %+v, From %s to Closed, time: %d\n",
rule.Strategy, prev.String(), util.CurrentTimeMillis())
-}
-
-func (s *stateChangeTestListener) OnTransformToOpen(prev circuitbreaker.State,
rule circuitbreaker.Rule, snapshot interface{}) {
- logger.Infof("rule.steategy: %+v, From %s to Open, snapshot: %.2f,
time: %d\n", rule.Strategy, prev.String(), snapshot, util.CurrentTimeMillis())
-}
-
-func (s *stateChangeTestListener) OnTransformToHalfOpen(prev
circuitbreaker.State, rule circuitbreaker.Rule) {
- logger.Infof("rule.steategy: %+v, From %s to Half-Open, time: %d\n",
rule.Strategy, prev.String(), util.CurrentTimeMillis())
-}
-
type GreetTripleServer struct {
}
diff --git a/filter/tpslimit/go-server/pkg/reject_handler.go
b/filter/tpslimit/go-server/pkg/reject_handler.go
index f0b1f0a5..67e7d0d8 100644
--- a/filter/tpslimit/go-server/pkg/reject_handler.go
+++ b/filter/tpslimit/go-server/pkg/reject_handler.go
@@ -75,7 +75,7 @@ func (mh *DefaultValueRejectedExecutionHandler)
RejectedExecution(url *common.UR
if !loaded {
// we didn't configure any default value for this invocation
return &protocol.RPCResult{
- Err: errors.New("The request is rejected and doesn't
have any default value. "),
+ Err: errors.New("the request is rejected and doesn't
have any default value"),
}
}
return result.(*protocol.RPCResult)
diff --git a/llm/config/config.go b/llm/config/config.go
index 2943b1d0..67ffd7dc 100644
--- a/llm/config/config.go
+++ b/llm/config/config.go
@@ -138,12 +138,12 @@ func Load(envFile string) (*Config, error) {
portStr := os.Getenv("SERVER_PORT")
if portStr == "" {
- configErr = fmt.Errorf("Error: SERVER_PORT environment
variable is not set\n")
+ configErr = fmt.Errorf("SERVER_PORT environment
variable is not set")
return
}
config.ServerPort, err = strconv.Atoi(portStr)
if err != nil {
- configErr = fmt.Errorf("Error converting SERVER_PORT to
int: %v\n", err)
+ configErr = fmt.Errorf("error converting SERVER_PORT to
int: %v", err)
return
}
diff --git a/llm/go-client/cmd/client.go b/llm/go-client/cmd/client.go
index 74c5d21e..6cdfa419 100644
--- a/llm/go-client/cmd/client.go
+++ b/llm/go-client/cmd/client.go
@@ -163,7 +163,7 @@ func main() {
input, _ := reader.ReadString('\n')
input = strings.TrimSpace(input)
if input != "" {
- if idx, err := strconv.Atoi(input); err == nil {
+ if idx, convErr := strconv.Atoi(input); convErr == nil {
if idx >= 1 && idx <= len(availableModels) {
currentModel = availableModels[idx-1]
} else {
diff --git a/llm/go-client/frontend/handlers/chat.go
b/llm/go-client/frontend/handlers/chat.go
index cb229102..562ad953 100644
--- a/llm/go-client/frontend/handlers/chat.go
+++ b/llm/go-client/frontend/handlers/chat.go
@@ -123,8 +123,8 @@ func (h *ChatHandler) Chat(c *gin.Context) {
return
}
defer func() {
- if err := stream.Close(); err != nil {
- logger.Errorf("Error closing stream: %v", err)
+ if closeErr := stream.Close(); closeErr != nil {
+ logger.Errorf("Error closing stream: %v", closeErr)
}
}()
@@ -150,9 +150,9 @@ func (h *ChatHandler) Chat(c *gin.Context) {
return
default:
if !stream.Recv() {
- if err := stream.Err(); err != nil {
-
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
- logger.Errorf("Stream receive
error: %v", err)
+ if streamErr := stream.Err(); streamErr
!= nil {
+
c.JSON(http.StatusInternalServerError, gin.H{"error": streamErr.Error()})
+ logger.Errorf("Stream receive
error: %v", streamErr)
}
h.ctxManager.AppendMessage(ctxID,
&chat.ChatMessage{
Role: "ai",
diff --git a/llm/go-server/cmd/server.go b/llm/go-server/cmd/server.go
index 49497026..75b01612 100644
--- a/llm/go-server/cmd/server.go
+++ b/llm/go-server/cmd/server.go
@@ -105,11 +105,11 @@ func (s *ChatServer) Chat(ctx context.Context, req
*chat.ChatRequest, stream cha
},
}
- if msg.Bin != nil && len(msg.Bin) != 0 {
- decodeByte, err :=
base64.StdEncoding.DecodeString(string(msg.Bin))
- if err != nil {
- logger.Errorf("GenerateContent failed: %v\n",
err)
- return fmt.Errorf("GenerateContent failed: %v",
err)
+ if len(msg.Bin) != 0 {
+ decodeByte, decodeErr :=
base64.StdEncoding.DecodeString(string(msg.Bin))
+ if decodeErr != nil {
+ logger.Errorf("GenerateContent failed: %v\n",
decodeErr)
+ return fmt.Errorf("GenerateContent failed: %v",
decodeErr)
}
imgType := http.DetectContentType(decodeByte)
messageContent.Parts = append(messageContent.Parts,
llms.BinaryPart(imgType, decodeByte))
diff --git a/llm/go-server/llm/llm_service.go b/llm/go-server/llm/llm_service.go
index 68732919..5af6c8c6 100644
--- a/llm/go-server/llm/llm_service.go
+++ b/llm/go-server/llm/llm_service.go
@@ -74,7 +74,7 @@ func NewLLMService(provider LLMProvider, model string,
baseURL string, apiKey st
apiKey = os.Getenv("OPENAI_API_KEY")
}
if apiKey == "" {
- return nil, fmt.Errorf("OpenAI API key is required")
+ return nil, fmt.Errorf("openai API key is required")
}
opts := []openai.Option{
@@ -95,7 +95,7 @@ func NewLLMService(provider LLMProvider, model string,
baseURL string, apiKey st
apiKey = os.Getenv("ANTHROPIC_API_KEY")
}
if apiKey == "" {
- return nil, fmt.Errorf("Anthropic API key is required")
+ return nil, fmt.Errorf("anthropic API key is required")
}
opts := []anthropic.Option{
@@ -116,7 +116,7 @@ func NewLLMService(provider LLMProvider, model string,
baseURL string, apiKey st
apiKey = os.Getenv("AZURE_OPENAI_API_KEY")
}
if apiKey == "" {
- return nil, fmt.Errorf("Azure OpenAI API key is
required")
+ return nil, fmt.Errorf("azure OpenAI API key is
required")
}
// Azure OpenAI uses OpenAI client with specific configuration
diff --git a/metrics/go-server/cmd/main.go b/metrics/go-server/cmd/main.go
index 518c77bc..cf7666cc 100644
--- a/metrics/go-server/cmd/main.go
+++ b/metrics/go-server/cmd/main.go
@@ -150,11 +150,8 @@ func main() {
ticker := time.NewTicker(10 * time.Second)
defer ticker.Stop()
- for {
- select {
- case <-ticker.C:
- pushedAt.Set(float64(time.Now().Unix()))
- }
+ for range ticker.C {
+ pushedAt.Set(float64(time.Now().Unix()))
}
}()
diff --git a/router/tag/go-client/cmd/client.go
b/router/tag/go-client/cmd/client.go
index ff4a4178..11a39a3b 100644
--- a/router/tag/go-client/cmd/client.go
+++ b/router/tag/go-client/cmd/client.go
@@ -19,7 +19,6 @@ package main
import (
"context"
- "strings"
)
import (
@@ -67,7 +66,7 @@ func main() {
panic(err)
}
- callGreet := func(name, tag, force, exp string) {
+ callGreet := func(name, tag, force string) {
// set tag attachments for invocation
atta := map[string]string{
constant.Tagkey: tag,
@@ -79,7 +78,6 @@ func main() {
// temporarily cancel checking for result, for PR # 3208
(https://github.com/apache/dubbo-go/pull/3208)
// hasn't been merged to main branch yet, thus tag router still
not works properly.
- //checkRes(exp, resp.GetGreeting(), err)
if err != nil {
logger.Errorf("❌ invoke failed: %v", err)
} else {
@@ -87,16 +85,8 @@ func main() {
}
}
- callGreet("tag with force", "test-tag", "true", "server-with-tag")
// success
- callGreet("tag with force", "test-tag1", "true", "fail")
// fail
- callGreet("tag with no-force", "test-tag1", "false",
"server-without-tag") // success
- callGreet("non-tag", "", "false", "server-without-tag")
// success
-}
-
-func checkRes(exp string, act string, err error) {
- if (err == nil && exp == "fail") || (err != nil && exp != "fail") {
- panic("unexpected result!")
- } else if act != "" && !strings.Contains(act, exp) {
- panic("unexpected result!")
- }
+ callGreet("tag with force", "test-tag", "true") // success
+ callGreet("tag with force", "test-tag1", "true") // fail
+ callGreet("tag with no-force", "test-tag1", "false") // success
+ callGreet("non-tag", "", "false") // success
}