This is an automated email from the ASF dual-hosted git repository.

yixia pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-seata-go-samples.git


The following commit(s) were added to refs/heads/main by this push:
     new 12fe9ff  fix samples conf file path (#44)
12fe9ff is described below

commit 12fe9ff083d15c1816e0816758730e37283a1ec1
Author: smiletrl <[email protected]>
AuthorDate: Thu Jan 25 11:29:06 2024 +0800

    fix samples conf file path (#44)
---
 README.md                      | 70 ++++++++++++++++++++++--------------------
 at/basic/main.go               |  2 +-
 at/gin/client/main.go          |  2 +-
 at/gin/server/main.go          |  2 +-
 at/gorm/main.go                |  2 +-
 at/non_transaction/main.go     |  2 +-
 at/rollback/client/main.go     |  2 +-
 at/rollback/server/main.go     |  2 +-
 at/rollback/server2/main.go    |  2 +-
 tcc/dubbo/client/cmd/client.go |  2 +-
 tcc/dubbo/server/cmd/server.go |  2 +-
 tcc/fence/cmd/main.go          |  2 +-
 tcc/gin/client/main.go         |  2 +-
 tcc/gin/server/main.go         |  2 +-
 tcc/grpc/cmd/client/main.go    |  3 +-
 tcc/grpc/cmd/server/main.go    |  2 +-
 tcc/local/cmd/local.go         |  2 +-
 tcc/propagation/first/main.go  |  2 +-
 xa/basic/main.go               |  2 +-
 xa/gin/client/main.go          |  2 +-
 xa/gin/server/main.go          |  2 +-
 xa/gorm/main.go                |  2 +-
 22 files changed, 59 insertions(+), 54 deletions(-)

diff --git a/README.md b/README.md
index 877377a..308c320 100644
--- a/README.md
+++ b/README.md
@@ -4,24 +4,27 @@
 
 1. Start the seata-server service with the docker file under the 
/dockercomposer folder
 
-   ````shell
+   ```shell
    git clone https://github.com/seata/seata-go-samples.git
-   ````
-   ````shell
+   ```
+
+   ```shell
    cd dockercompose
-   ````
-   ````shell
+   ```
+
+   ```shell
    docker-compose -f docker-compose.yml up -d seata-server
-   ````
+   ```
 
 2. Start and run a sample, for example let's run a basic distributed 
transaction sample of AT
 
-   ````shell
+   ```shell
    cd at/basic
-   ````
-   ````shell
-   go run main.go
-   ````
+   ```
+
+   ```shell
+   go run .
+   ```
 
 ### Customize mysql connection configurations
 
@@ -30,6 +33,7 @@ The default mysql connection configuration is suitable with 
dockercompose/docker
 You can also customize it by system environment.
 
 System Env Supported:
+
 1. MYSQL_HOST
 2. MYSQL_PORT
 3. MYSQL_USERNAME
@@ -41,35 +45,35 @@ System Env Supported:
 1. Modify the seata-go dependency version to v0.0.0-incompatible, and remove 
the version number if it exists in the
    original dependency path.
 
-   ````
+   ```
    //github.com/seata/seata-go v1.0.3
    github.com/seata/seata-go v0.0.0-incompatibl
-   ````
+   ```
 
 2. Find the absolute or relative path to your local code.
 
-   ````
+   ```
    /Users/mac/Desktop/GO/seata-go
    ../seata-go
-   ````
+   ```
 
 3. Add the replace module to the go.mod file and change it to the local code 
path.
 
-   ````
+   ```
    github.com/seata/seata-go =>  ../seata-go
-   ````
+   ```
 
 4. Synchronization dependencies.
 
-   ````shell
+   ```shell
    go mod tidy
-   ````
+   ```
 
 5. Run the sample test code.
 
 ## How to use go workspace to test samples for new PR (Recommended)
 
-You can use your local project forked to test new pr that haven't merged into 
github.com/seata/seata-go. 
+You can use your local project forked to test new pr that haven't merged into 
github.com/seata/seata-go.
 
 1. Make sure your go version is 1.18 or later.
 
@@ -77,42 +81,42 @@ You can use your local project forked to test new pr that 
haven't merged into gi
 
 For examples:
 
-````text
+```text
 /Users/xxx/code/github.com/yourid/seata-go
 /Users/xxx/code/github.com/yourid/seata-go-samples
-````
+```
 
 3. Execute go work init command in projects root directory.
 
-````shell
+```shell
 cd /Users/xxx/code/github.com/yourid
-````
+```
 
-````shell
+```shell
 go work init
-````
+```
 
 You will find a go.work file in /Users/xxx/code/github.com/yourid.
 
 4. Add seata-go and seata-go-samples into the same go workspace.
 
-````shell
+```shell
 go work use ./seata-go
-````
+```
 
-````shell
+```shell
 go work use ./seata-go-samples
-````
+```
 
 Now, the content of go.work file is as follows.
 
-````text
+```text
 go 1.19
 
 use (
         ./seata-go
         ./seata-go-samples
 )
-````
+```
 
-5. Run the sample test code in seata-go-samples.
\ No newline at end of file
+5. Run the sample test code in seata-go-samples.
diff --git a/at/basic/main.go b/at/basic/main.go
index ec5fb19..1625103 100644
--- a/at/basic/main.go
+++ b/at/basic/main.go
@@ -30,7 +30,7 @@ import (
 var db *sql.DB
 
 func main() {
-       client.InitPath("./conf/seatago.yml")
+       client.InitPath("../../conf/seatago.yml")
        db = util.GetAtMySqlDb()
        ctx := context.Background()
 
diff --git a/at/gin/client/main.go b/at/gin/client/main.go
index 5cb1225..390e272 100644
--- a/at/gin/client/main.go
+++ b/at/gin/client/main.go
@@ -29,7 +29,7 @@ var serverIpPort = "http://127.0.0.1:8080";
 
 func main() {
        flag.Parse()
-       client.InitPath("./conf/seatago.yml")
+       client.InitPath("../../../conf/seatago.yml")
 
        bgCtx, cancel := context.WithTimeout(context.Background(), 
time.Minute*10)
        defer cancel()
diff --git a/at/gin/server/main.go b/at/gin/server/main.go
index 3855950..c3cec2b 100644
--- a/at/gin/server/main.go
+++ b/at/gin/server/main.go
@@ -31,7 +31,7 @@ import (
 var db *sql.DB
 
 func main() {
-       client.InitPath("./conf/seatago.yml")
+       client.InitPath("../../../conf/seatago.yml")
        db = util.GetAtMySqlDb()
 
        r := gin.Default()
diff --git a/at/gorm/main.go b/at/gorm/main.go
index dcea5aa..9c8e751 100644
--- a/at/gorm/main.go
+++ b/at/gorm/main.go
@@ -50,7 +50,7 @@ func main() {
 
 func initConfig() {
        // init seata client config
-       client.InitPath("./conf/seatago.yml")
+       client.InitPath("../../conf/seatago.yml")
        // init db object
        initDB()
 }
diff --git a/at/non_transaction/main.go b/at/non_transaction/main.go
index 37cf5a2..5492964 100644
--- a/at/non_transaction/main.go
+++ b/at/non_transaction/main.go
@@ -46,7 +46,7 @@ var (
 var db *sql.DB
 
 func main() {
-       client.InitPath("./conf/seatago.yml")
+       client.InitPath("../../conf/seatago.yml")
        db = util.GetAtMySqlDb()
 
        insertId := insertData()
diff --git a/at/rollback/client/main.go b/at/rollback/client/main.go
index 9863f75..1bdbc45 100644
--- a/at/rollback/client/main.go
+++ b/at/rollback/client/main.go
@@ -32,7 +32,7 @@ var (
 
 func main() {
        flag.Parse()
-       client.InitPath("./conf/seatago.yml")
+       client.InitPath("../../../conf/seatago.yml")
 
        bgCtx, cancel := context.WithTimeout(context.Background(), 
time.Minute*10)
        defer cancel()
diff --git a/at/rollback/server/main.go b/at/rollback/server/main.go
index c7bfdf6..17c9aff 100644
--- a/at/rollback/server/main.go
+++ b/at/rollback/server/main.go
@@ -31,7 +31,7 @@ import (
 var db *sql.DB
 
 func main() {
-       client.InitPath("./conf/seatago.yml")
+       client.InitPath("../../../conf/seatago.yml")
        db = util.GetAtMySqlDb()
 
        r := gin.Default()
diff --git a/at/rollback/server2/main.go b/at/rollback/server2/main.go
index 9a45b71..7bd0c73 100644
--- a/at/rollback/server2/main.go
+++ b/at/rollback/server2/main.go
@@ -31,7 +31,7 @@ import (
 var db *sql.DB
 
 func main() {
-       client.InitPath("./conf/seatago.yml")
+       client.InitPath("../../../conf/seatago.yml")
        db = util.GetAtMySqlDb()
 
        r := gin.Default()
diff --git a/tcc/dubbo/client/cmd/client.go b/tcc/dubbo/client/cmd/client.go
index cb63afd..e74df5a 100644
--- a/tcc/dubbo/client/cmd/client.go
+++ b/tcc/dubbo/client/cmd/client.go
@@ -31,7 +31,7 @@ import (
 
 // need to setup environment variable "DUBBO_GO_CONFIG_PATH" to 
"conf/dubbogo.yml" before run
 func main() {
-       client.InitPath("./sample/conf/seatago.yml")
+       client.InitPath("../../../../conf/seatago.yml")
        config.SetConsumerService(service.UserProviderInstance)
        if err := config.Load(); err != nil {
                panic(err)
diff --git a/tcc/dubbo/server/cmd/server.go b/tcc/dubbo/server/cmd/server.go
index 54d423b..20e7bb5 100644
--- a/tcc/dubbo/server/cmd/server.go
+++ b/tcc/dubbo/server/cmd/server.go
@@ -35,7 +35,7 @@ import (
 
 // need to setup environment variable "DUBBO_GO_CONFIG_PATH" to 
"conf/dubbogo.yml" before run
 func main() {
-       client.InitPath("./sample/conf/seatago.yml")
+       client.InitPath("../../../../conf/seatago.yml")
        userProviderProxy, err := 
tcc.NewTCCServiceProxy(&service.UserProvider{})
        if err != nil {
                log.Errorf("get userProviderProxy tcc service proxy error, %v", 
err.Error())
diff --git a/tcc/fence/cmd/main.go b/tcc/fence/cmd/main.go
index d6f3992..4e37883 100644
--- a/tcc/fence/cmd/main.go
+++ b/tcc/fence/cmd/main.go
@@ -29,7 +29,7 @@ import (
 )
 
 func main() {
-       client.InitPath("./sample/conf/seatago.yml")
+       client.InitPath("../../../conf/seatago.yml")
        tm.WithGlobalTx(context.Background(), &tm.GtxConfig{
                Name: "TccSampleLocalGlobalTx",
        }, business)
diff --git a/tcc/gin/client/main.go b/tcc/gin/client/main.go
index 70c3eed..2354488 100644
--- a/tcc/gin/client/main.go
+++ b/tcc/gin/client/main.go
@@ -32,7 +32,7 @@ import (
 
 func main() {
        flag.Parse()
-       client.InitPath("./sample/conf/seatago.yml")
+       client.InitPath("../../../conf/seatago.yml")
        bgCtx, cancel := context.WithTimeout(context.Background(), 
time.Minute*10)
        defer cancel()
        serverIpPort := "http://127.0.0.1:8080";
diff --git a/tcc/gin/server/main.go b/tcc/gin/server/main.go
index c03266b..58eefae 100644
--- a/tcc/gin/server/main.go
+++ b/tcc/gin/server/main.go
@@ -29,7 +29,7 @@ import (
 )
 
 func main() {
-       client.InitPath("./sample/conf/seatago.yml")
+       client.InitPath("../../../conf/seatago.yml")
 
        r := gin.Default()
 
diff --git a/tcc/grpc/cmd/client/main.go b/tcc/grpc/cmd/client/main.go
index 45aef4f..174b7ab 100644
--- a/tcc/grpc/cmd/client/main.go
+++ b/tcc/grpc/cmd/client/main.go
@@ -45,7 +45,8 @@ func main() {
        defer conn.Close()
        c1, c2 := pb.NewTCCServiceBusiness1Client(conn), 
pb.NewTCCServiceBusiness2Client(conn)
 
-       client.InitPath("./conf/seatago.yml")
+       client.InitPath("../../../../conf/seatago.yml")
+
        tm.WithGlobalTx(
                context.Background(),
                &tm.GtxConfig{
diff --git a/tcc/grpc/cmd/server/main.go b/tcc/grpc/cmd/server/main.go
index 842b756..0781b71 100644
--- a/tcc/grpc/cmd/server/main.go
+++ b/tcc/grpc/cmd/server/main.go
@@ -33,7 +33,7 @@ import (
 )
 
 func main() {
-       client.InitPath("./conf/seatago.yml")
+       client.InitPath("../../../../conf/seatago.yml")
        lis, err := net.Listen("tcp", fmt.Sprintf(":%d", 50051))
        if err != nil {
                log.Fatalf("failed to listen: %v", err)
diff --git a/tcc/local/cmd/local.go b/tcc/local/cmd/local.go
index ce294e1..3b788a8 100644
--- a/tcc/local/cmd/local.go
+++ b/tcc/local/cmd/local.go
@@ -27,7 +27,7 @@ import (
 )
 
 func main() {
-       client.InitPath("./sample/conf/seatago.yml")
+       client.InitPath("../../../conf/seatago.yml")
        tm.WithGlobalTx(context.Background(), &tm.GtxConfig{
                Name: "TccSampleLocalGlobalTx",
        }, business)
diff --git a/tcc/propagation/first/main.go b/tcc/propagation/first/main.go
index 4a79f44..dfb58be 100644
--- a/tcc/propagation/first/main.go
+++ b/tcc/propagation/first/main.go
@@ -30,7 +30,7 @@ import (
 )
 
 func main() {
-       client.InitPath("./sample/conf/seatago.yml")
+       client.InitPath("../../../conf/seatago.yml")
        log.Info(tm.WithGlobalTx(context.Background(), &tm.GtxConfig{
                Name: "TccSampleLocalGlobalTxFirst",
        }, business))
diff --git a/xa/basic/main.go b/xa/basic/main.go
index 338569c..727acc0 100644
--- a/xa/basic/main.go
+++ b/xa/basic/main.go
@@ -30,7 +30,7 @@ import (
 var db *sql.DB
 
 func main() {
-       client.InitPath("./conf/seatago.yml")
+       client.InitPath("../../conf/seatago.yml")
        db = util.GetXAMySqlDb()
        ctx := context.Background()
 
diff --git a/xa/gin/client/main.go b/xa/gin/client/main.go
index c855a9f..6d7cf93 100644
--- a/xa/gin/client/main.go
+++ b/xa/gin/client/main.go
@@ -29,7 +29,7 @@ var serverIpPort = "http://127.0.0.1:8080";
 
 func main() {
        flag.Parse()
-       client.InitPath("./conf/seatago.yml")
+       client.InitPath("../../../conf/seatago.yml")
 
        bgCtx, cancel := context.WithTimeout(context.Background(), 
time.Minute*10)
        defer cancel()
diff --git a/xa/gin/server/main.go b/xa/gin/server/main.go
index c9840fb..918a356 100644
--- a/xa/gin/server/main.go
+++ b/xa/gin/server/main.go
@@ -31,7 +31,7 @@ import (
 var db *sql.DB
 
 func main() {
-       client.InitPath("./conf/seatago.yml")
+       client.InitPath("../../../conf/seatago.yml")
        db = util.GetXAMySqlDb()
 
        r := gin.Default()
diff --git a/xa/gorm/main.go b/xa/gorm/main.go
index de0b657..5132c15 100644
--- a/xa/gorm/main.go
+++ b/xa/gorm/main.go
@@ -50,7 +50,7 @@ func main() {
 
 func initConfig() {
        // init seata client config
-       client.InitPath("./conf/seatago.yml")
+       client.InitPath("../../conf/seatago.yml")
        // init db object
        initDB()
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to