GithubHelp home page GithubHelp logo

pyjcode / seata-go-samples Goto Github PK

View Code? Open in Web Editor NEW

This project forked from apache/incubator-seata-go-samples

0.0 1.0 0.0 10.04 MB

samples for seata-go

License: Apache License 2.0

Shell 3.94% Go 95.35% Makefile 0.71%

seata-go-samples's Introduction

seata-go-samples

How to run samples

  1. Start the seata-server service with the docker file under the /dockercomposer folder

    git clone https://github.com/seata/seata-go-samples.git
    cd dockercompose
    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

    cd at/basic
    go run main.go

Customize mysql connection configurations

The default mysql connection configuration is suitable with dockercompose/docker-compose.yml.

You can also customize it by system environment.

System Env Supported:

  1. MYSQL_HOST
  2. MYSQL_PORT
  3. MYSQL_USERNAME
  4. MYSQL_PASSWORD
  5. MYSQL_DB

How to use go mod replace to test samples for new PR

  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.

    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.

  1. Make sure your go version is 1.18 or later.

  2. Fork and download two projects (seata-go and seata-go-samples), and put them into a same local directory.

For examples:

/Users/xxx/code/github.com/yourid/seata-go
/Users/xxx/code/github.com/yourid/seata-go-samples
  1. Execute go work init command in projects root directory.
cd /Users/xxx/code/github.com/yourid
go work init

You will find a go.work file in /Users/xxx/code/github.com/yourid.

  1. Add seata-go and seata-go-samples into the same go workspace.
go work use ./seata-go
go work use ./seata-go-samples

Now, the content of go.work file is as follows.

go 1.19

use (
        ./seata-go
        ./seata-go-samples
)
  1. Run the sample test code in seata-go-samples.

seata-go-samples's People

Contributors

charlie17li avatar isupercoder avatar vaderkai avatar luky116 avatar georgehao avatar code-fight avatar slievrly avatar wang1309 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.