Skip to content

Commit 345a212

Browse files
authored
Merge branch 'master' into master_25_09_24_03
2 parents ee12803 + 7d32bd3 commit 345a212

File tree

8 files changed

+91
-17
lines changed

8 files changed

+91
-17
lines changed

.github/workflows/integrate-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
- name: "set up go"
4545
uses: actions/setup-go@v3
4646
with:
47-
go-version: 1.20.0
47+
go-version: 1.20.14
4848

4949
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
5050
- name: "checkout ${{ github.ref }}"

VERSION

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
v2.0.0-rc01

cmd/start.go

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,67 @@
1717

1818
package main
1919

20+
import (
21+
"flag"
22+
"fmt"
23+
"os"
24+
)
25+
26+
var (
27+
// Version information set by build flags
28+
Version string
29+
Branch string
30+
Revision string
31+
showVersion bool
32+
showHelp bool
33+
)
34+
35+
func init() {
36+
flag.BoolVar(&showVersion, "version", false, "show version information")
37+
flag.BoolVar(&showVersion, "v", false, "show version information")
38+
flag.BoolVar(&showHelp, "help", false, "show help information")
39+
flag.BoolVar(&showHelp, "h", false, "show help information")
40+
}
41+
2042
func main() {
43+
44+
hasV := false
45+
hasVersion := false
46+
47+
for _, arg := range os.Args[1:] {
48+
if arg == "-v" {
49+
hasV = true
50+
}
51+
if arg == "-version" || arg == "--version" {
52+
hasVersion = true
53+
}
54+
}
55+
56+
if hasV && hasVersion {
57+
fmt.Fprintf(os.Stderr, "Error: cannot use both -v and --version at the same time\n")
58+
os.Exit(1)
59+
}
60+
61+
flag.Parse()
62+
if showHelp {
63+
flag.Usage()
64+
return
65+
}
66+
67+
if showVersion {
68+
versionPrint := Version
69+
if versionPrint == "" {
70+
versionPrint = "unknown"
71+
}
72+
fmt.Printf("Seata-go version: %s\n", versionPrint)
73+
if Branch != "" {
74+
fmt.Printf("Branch: %s\n", Branch)
75+
}
76+
if Revision != "" {
77+
fmt.Printf("Revision: %s\n", Revision)
78+
}
79+
return
80+
}
81+
2182
// start the server
2283
}

makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
VERSION=$(shell cat "./VERSION" 2> /dev/null)
18+
VERSION=$(shell tail -n 1 "./VERSION" 2> /dev/null)
1919

2020
GO_FLAGS := -ldflags "-X main.Branch=$(GIT_BRANCH) -X main.Revision=$(GIT_REVISION) -X main.Version=$(VERSION) -extldflags \"-static\" -s -w" -tags netgo
2121
GO = go

pkg/datasource/sql/datasource/base/meta_cache_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ func (m *mockTrigger) LoadAll(ctx context.Context, dbName string, conn *sql.Conn
7373

7474
func TestBaseTableMetaCache_refresh(t *testing.T) {
7575
type fields struct {
76-
lock sync.RWMutex
7776
expireDuration time.Duration
7877
capity int32
7978
size int32
@@ -96,7 +95,6 @@ func TestBaseTableMetaCache_refresh(t *testing.T) {
9695
{
9796
name: "test1",
9897
fields: fields{
99-
lock: sync.RWMutex{},
10098
capity: capacity,
10199
size: 0,
102100
expireDuration: EexpireTime,
@@ -117,7 +115,6 @@ func TestBaseTableMetaCache_refresh(t *testing.T) {
117115
{
118116
name: "test2",
119117
fields: fields{
120-
lock: sync.RWMutex{},
121118
capity: capacity,
122119
size: 0,
123120
expireDuration: EexpireTime,
@@ -154,7 +151,6 @@ func TestBaseTableMetaCache_refresh(t *testing.T) {
154151
defer loadAllStub.Reset()
155152

156153
c := &BaseTableMetaCache{
157-
lock: tt.fields.lock,
158154
expireDuration: tt.fields.expireDuration,
159155
capity: tt.fields.capity,
160156
size: tt.fields.size,

pkg/datasource/sql/exec/at/base_executor_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ func TestBaseExecBuildLockKey(t *testing.T) {
6767
types.RecordImage{
6868
TableName: "test_name",
6969
Rows: []types.RowImage{
70-
{[]types.ColumnImage{getColumnImage("id", 1), getColumnImage("userId", "user1")}},
71-
{[]types.ColumnImage{getColumnImage("id", 2), getColumnImage("userId", "user2")}},
70+
{Columns: []types.ColumnImage{getColumnImage("id", 1), getColumnImage("userId", "user1")}},
71+
{Columns: []types.ColumnImage{getColumnImage("id", 2), getColumnImage("userId", "user2")}},
7272
},
7373
},
7474
"TEST_NAME:1_user1,2_user2",
@@ -84,9 +84,9 @@ func TestBaseExecBuildLockKey(t *testing.T) {
8484
types.RecordImage{
8585
TableName: "test2_name",
8686
Rows: []types.RowImage{
87-
{[]types.ColumnImage{getColumnImage("id", 1), getColumnImage("userId", "one"), getColumnImage("age", "11")}},
88-
{[]types.ColumnImage{getColumnImage("id", 2), getColumnImage("userId", "two"), getColumnImage("age", "22")}},
89-
{[]types.ColumnImage{getColumnImage("id", 3), getColumnImage("userId", "three"), getColumnImage("age", "33")}},
87+
{Columns: []types.ColumnImage{getColumnImage("id", 1), getColumnImage("userId", "one"), getColumnImage("age", "11")}},
88+
{Columns: []types.ColumnImage{getColumnImage("id", 2), getColumnImage("userId", "two"), getColumnImage("age", "22")}},
89+
{Columns: []types.ColumnImage{getColumnImage("id", 3), getColumnImage("userId", "three"), getColumnImage("age", "33")}},
9090
},
9191
},
9292
"TEST2_NAME:1_one_11,2_two_22,3_three_33",

pkg/datasource/sql/undo/builder/basic_undo_log_builder_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ func TestBuildLockKey(t *testing.T) {
9393
types.RecordImage{
9494
TableName: "test_name",
9595
Rows: []types.RowImage{
96-
{[]types.ColumnImage{getColumnImage("id", 1), getColumnImage("userId", "one")}},
97-
{[]types.ColumnImage{getColumnImage("id", 2), getColumnImage("userId", "two")}},
96+
{Columns: []types.ColumnImage{getColumnImage("id", 1), getColumnImage("userId", "one")}},
97+
{Columns: []types.ColumnImage{getColumnImage("id", 2), getColumnImage("userId", "two")}},
9898
},
9999
},
100100
"TEST_NAME:1_one,2_two",
@@ -110,9 +110,9 @@ func TestBuildLockKey(t *testing.T) {
110110
types.RecordImage{
111111
TableName: "test2_name",
112112
Rows: []types.RowImage{
113-
{[]types.ColumnImage{getColumnImage("id", 1), getColumnImage("userId", "one"), getColumnImage("age", "11")}},
114-
{[]types.ColumnImage{getColumnImage("id", 2), getColumnImage("userId", "two"), getColumnImage("age", "22")}},
115-
{[]types.ColumnImage{getColumnImage("id", 3), getColumnImage("userId", "three"), getColumnImage("age", "33")}},
113+
{Columns: []types.ColumnImage{getColumnImage("id", 1), getColumnImage("userId", "one"), getColumnImage("age", "11")}},
114+
{Columns: []types.ColumnImage{getColumnImage("id", 2), getColumnImage("userId", "two"), getColumnImage("age", "22")}},
115+
{Columns: []types.ColumnImage{getColumnImage("id", 3), getColumnImage("userId", "three"), getColumnImage("age", "33")}},
116116
},
117117
},
118118
"TEST2_NAME:1_one_11,2_two_22,3_three_33",

pkg/integration/gin/gin_transaction_middleware.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TransactionMiddleware() gin.HandlerFunc {
3737
}
3838

3939
if len(xid) == 0 {
40-
log.Errorf("Gin: header not contain header: %s, global transaction xid", constant.XidKey)
40+
log.Errorf("Gin: header does not contain: %s or %s, global transaction xid is missing", constant.XidKey, constant.XidKeyLowercase)
4141
ctx.AbortWithStatus(http.StatusBadRequest)
4242
return
4343
}

0 commit comments

Comments
 (0)