From 5217e15c53f61c525a058199331194587602b3ea Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Sat, 6 Feb 2021 16:45:16 +0300 Subject: [PATCH 1/4] Update CI, Relay, PR template and dependabot --- .github/dependabot.yml | 12 +++ .github/pull_request_template.md | 24 ++++++ .github/workflows/linters.yml | 25 +++++++ .github/workflows/{ci-build.yml => linux.yml} | 35 ++------- .github/workflows/macos.yml | 49 ++++++++++++ .github/workflows/windows.yml | 48 ++++++++++++ CHANGELOG.md | 6 ++ README.md | 5 +- go.mod | 1 + go.sum | 74 +------------------ pkg/pipe/pipe.go | 3 +- .../relay/relay.go => pkg/relay/interface.go | 0 pkg/rpc/client.go | 2 +- pkg/rpc/codec.go | 2 +- pkg/shared_memory/{shm.go => interface.go} | 0 pkg/shared_memory/{ => posix}/posix_shm.go | 2 +- .../{ => posix}/posix_shm_test.go | 2 +- .../{ => windows}/shm_windows.go | 2 +- .../{ => windows}/shm_windows_test.go | 2 +- pkg/socket/socket.go | 3 +- 20 files changed, 184 insertions(+), 113 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/linters.yml rename .github/workflows/{ci-build.yml => linux.yml} (63%) create mode 100644 .github/workflows/macos.yml create mode 100644 .github/workflows/windows.yml rename interfaces/relay/relay.go => pkg/relay/interface.go (100%) rename pkg/shared_memory/{shm.go => interface.go} (100%) rename pkg/shared_memory/{ => posix}/posix_shm.go (99%) rename pkg/shared_memory/{ => posix}/posix_shm_test.go (98%) rename pkg/shared_memory/{ => windows}/shm_windows.go (98%) rename pkg/shared_memory/{ => windows}/shm_windows_test.go (95%) diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..2c56120 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: gomod # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: daily + diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..e2385a1 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,24 @@ +# Reason for This PR + +`[Author TODO: add issue # or explain reasoning.]` + +## Description of Changes + +`[Author TODO: add description of changes.]` + +## License Acceptance + +By submitting this pull request, I confirm that my contribution is made under +the terms of the MIT license. + +## PR Checklist + +`[Author TODO: Meet these criteria.]` +`[Reviewer TODO: Verify that these criteria are met. Request changes if not]` + +- [ ] All commits in this PR are signed (`git commit -s`) or (`git commit -S`). +- [ ] The reason for this PR is clearly provided (issue no. or explanation). +- [ ] The description of changes is clear and encompassing. +- [ ] Any required documentation changes (code and docs) are included in this PR. +- [ ] Any user-facing changes are mentioned in `CHANGELOG.md`. +- [ ] All added/changed functionality is tested. diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml new file mode 100644 index 0000000..c284f90 --- /dev/null +++ b/.github/workflows/linters.yml @@ -0,0 +1,25 @@ +name: Linters + +on: + push: + pull_request: + branches: + # Branches from forks have the form 'user:branch-name' so we only run + # this job on pull_request events for branches that look like fork + # branches. Without this we would end up running this job twice for non + # forked PRs, once for the push and then once for opening the PR. + - '**:**' + +jobs: + golangci-lint: + name: Golang-CI (lint) + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Run linter + uses: golangci/golangci-lint-action@v2 # Action page: + with: + version: v1.35 # without patch version + only-new-issues: false # show only new issues if it's a pull request \ No newline at end of file diff --git a/.github/workflows/ci-build.yml b/.github/workflows/linux.yml similarity index 63% rename from .github/workflows/ci-build.yml rename to .github/workflows/linux.yml index c044a3d..ed933cb 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/linux.yml @@ -1,4 +1,4 @@ -name: CI +name: Linux on: push: @@ -12,14 +12,14 @@ on: jobs: build: - name: Build (Go ${{ matrix.go }} OS ${{ matrix.os }}) + name: Tests [Go ${{ matrix.go }} OS ${{ matrix.os }}] runs-on: ${{ matrix.os }} timeout-minutes: 20 strategy: - fail-fast: false + fail-fast: true matrix: go: [ 1.14, 1.15 ] - os: [ ubuntu-latest, windows-latest, macos-latest ] + os: [ ubuntu-20.04] steps: - name: Set up Go ${{ matrix.go }} uses: actions/setup-go@v2 @@ -39,18 +39,7 @@ jobs: - name: Install Go dependencies run: go mod download - - - name: Run golang tests on Windows without codecov - if: ${{ matrix.os == 'windows-latest' }} - run: | - go test -v -race -tags=debug ./pkg/frame - go test -v -race -tags=debug ./pkg/pipe - go test -v -race -tags=debug ./pkg/rpc - go test -v -race -tags=debug ./pkg/socket - - - - name: Run golang tests on MacOS or Linux with codecov - if: ${{ matrix.os != 'windows-latest' }} + - name: Run golang tests on Linux with codecov run: | mkdir ./coverage-ci go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/frame.txt -covermode=atomic ./pkg/frame @@ -60,21 +49,7 @@ jobs: cat ./coverage-ci/*.txt > ./coverage-ci/summary.txt - uses: codecov/codecov-action@v1 # Docs: - if: ${{ matrix.os != 'windows-latest' }} with: token: ${{ secrets.CODECOV_TOKEN }} file: ./coverage-ci/summary.txt fail_ci_if_error: false - - golangci-lint: - name: Golang-CI (lint) - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - - name: Run linter - uses: golangci/golangci-lint-action@v2 # Action page: - with: - version: v1.35 # without patch version - only-new-issues: false # show only new issues if it's a pull request \ No newline at end of file diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 0000000..ac5a5e8 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,49 @@ +name: MacOS + +on: + push: + pull_request: + branches: + # Branches from forks have the form 'user:branch-name' so we only run + # this job on pull_request events for branches that look like fork + # branches. Without this we would end up running this job twice for non + # forked PRs, once for the push and then once for opening the PR. + - '**:**' + +jobs: + build: + name: Tests [Go ${{ matrix.go }} OS ${{ matrix.os }}] + runs-on: ${{ matrix.os }} + timeout-minutes: 20 + strategy: + fail-fast: true + matrix: + go: [ 1.14, 1.15 ] + os: [ macos-latest ] + steps: + - name: Set up Go ${{ matrix.go }} + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + + - name: Check out code + uses: actions/checkout@v2 + + - name: Init Go modules Cache # Docs: + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-go- + + - name: Install Go dependencies + run: go mod download + + - name: Run golang tests on MacOS + run: | + mkdir ./coverage-ci + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/frame.txt -covermode=atomic ./pkg/frame + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pipe.txt -covermode=atomic ./pkg/pipe + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/rpc.txt -covermode=atomic ./pkg/rpc + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/socket.txt -covermode=atomic ./pkg/socket + cat ./coverage-ci/*.txt > ./coverage-ci/summary.txt diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000..e5bd72c --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,48 @@ +name: Windows + +on: + push: + pull_request: + branches: + # Branches from forks have the form 'user:branch-name' so we only run + # this job on pull_request events for branches that look like fork + # branches. Without this we would end up running this job twice for non + # forked PRs, once for the push and then once for opening the PR. + - '**:**' + +jobs: + build: + name: Tests [Go ${{ matrix.go }} OS ${{ matrix.os }}] + runs-on: ${{ matrix.os }} + timeout-minutes: 20 + strategy: + fail-fast: true + matrix: + go: [ 1.14, 1.15 ] + os: [ windows-latest ] + steps: + - name: Set up Go ${{ matrix.go }} + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + + - name: Check out code + uses: actions/checkout@v2 + + - name: Init Go modules Cache # Docs: + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-go- + + - name: Install Go dependencies + run: go mod download + + + - name: Run golang tests on Windows + run: | + go test -v -race -tags=debug ./pkg/frame + go test -v -race -tags=debug ./pkg/pipe + go test -v -race -tags=debug ./pkg/rpc + go test -v -race -tags=debug ./pkg/socket diff --git a/CHANGELOG.md b/CHANGELOG.md index 6764b29..9dea482 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ CHANGELOG ========= +### v3.0.1 (06.02.2021) +- Move relay interface to the pkg folder. +- Separate CI into Linux, MacOS, Windows and Linters. +- Add PR template. +- Add dependabot. + ### v3.0.0 (18.01.2021) - New protocol (pkg/frame/frame.md) - Various payloads support: msgpack, raw bytes, JSON, gob. diff --git a/README.md b/README.md index c0071b5..3c37eb8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,10 @@ High-performance PHP-to-Golang IPC bridge ================================================= [![Latest Stable Version](https://poser.pugx.org/spiral/goridge/v/stable)](https://packagist.org/packages/spiral/goridge) [![GoDoc](https://godoc.org/github.com/spiral/goridge?status.svg)](https://godoc.org/github.com/spiral/goridge) -![CI](https://github.com/spiral/goridge/workflows/CI/badge.svg) +![Linux](https://github.com/spiral/goridge/workflows/Linux/badge.svg) +![macOS](https://github.com/spiral/goridge/workflows/MacOS/badge.svg) +![Windows](https://github.com/spiral/goridge/workflows/Windows/badge.svg) +![Linters](https://github.com/spiral/goridge/workflows/Linters/badge.svg) [![Go Report Card](https://goreportcard.com/badge/github.com/spiral/goridge)](https://goreportcard.com/report/github.com/spiral/goridge) [![Codecov](https://codecov.io/gh/spiral/goridge/branch/master/graph/badge.svg)](https://codecov.io/gh/spiral/goridge/) diff --git a/go.mod b/go.mod index d699026..6388ee1 100644 --- a/go.mod +++ b/go.mod @@ -8,4 +8,5 @@ require ( github.com/stretchr/testify v1.6.1 github.com/vmihailenco/msgpack v4.0.4+incompatible go.uber.org/multierr v1.6.0 + google.golang.org/appengine v1.6.7 // indirect ) diff --git a/go.sum b/go.sum index f04093b..74321a7 100644 --- a/go.sum +++ b/go.sum @@ -1,32 +1,9 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -34,19 +11,16 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OH github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/spiral/errors v1.0.5 h1:TwlR9cZtTgnZrSngcEUpyiMO9yJ45gdQ+XcrCRoCCAM= github.com/spiral/errors v1.0.5/go.mod h1:SwMSZVdZkkJVgXNNafccqOaxWg0XPzVU/dEdUEInE0o= +github.com/spiral/goridge v1.0.4 h1:qnYtI84H0tcYjcbFdFl/VUFQZ0YUE9p+VuU8In4kC/8= +github.com/spiral/goridge v2.1.4+incompatible h1:L15TKrbPEp/G6JfS3jjuvY6whkhfD292XX+1iy9mO2k= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a h1:0R4NLDRDZX6JcmhJgXi5E4b8Wg84ihbmUKp/GvSPEzc= -github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= @@ -54,59 +28,15 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65 h1:+rhAzEzT3f4JtomfC371qB+0Ola2caSKcY69NUBZrRQ= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11 h1:lwlPPsmjDKK0J6eG6xDWd5XPehI0R024zxjDnw3esPA= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pkg/pipe/pipe.go b/pkg/pipe/pipe.go index 4e4762c..ddf0566 100644 --- a/pkg/pipe/pipe.go +++ b/pkg/pipe/pipe.go @@ -4,7 +4,6 @@ import ( "io" "github.com/spiral/errors" - "github.com/spiral/goridge/v3/interfaces/relay" "github.com/spiral/goridge/v3/internal" "github.com/spiral/goridge/v3/pkg/frame" ) @@ -17,7 +16,7 @@ type Relay struct { } // NewPipeRelay creates new pipe based data relay. -func NewPipeRelay(in io.ReadCloser, out io.WriteCloser) relay.Relay { +func NewPipeRelay(in io.ReadCloser, out io.WriteCloser) *Relay { return &Relay{in: in, out: out} } diff --git a/interfaces/relay/relay.go b/pkg/relay/interface.go similarity index 100% rename from interfaces/relay/relay.go rename to pkg/relay/interface.go diff --git a/pkg/rpc/client.go b/pkg/rpc/client.go index d043fb2..3f1a742 100644 --- a/pkg/rpc/client.go +++ b/pkg/rpc/client.go @@ -7,8 +7,8 @@ import ( "net/rpc" "github.com/spiral/errors" - "github.com/spiral/goridge/v3/interfaces/relay" "github.com/spiral/goridge/v3/pkg/frame" + "github.com/spiral/goridge/v3/pkg/relay" "github.com/spiral/goridge/v3/pkg/socket" ) diff --git a/pkg/rpc/codec.go b/pkg/rpc/codec.go index 67da6a0..55d63ef 100644 --- a/pkg/rpc/codec.go +++ b/pkg/rpc/codec.go @@ -8,8 +8,8 @@ import ( j "github.com/json-iterator/go" "github.com/spiral/errors" - "github.com/spiral/goridge/v3/interfaces/relay" "github.com/spiral/goridge/v3/pkg/frame" + "github.com/spiral/goridge/v3/pkg/relay" "github.com/spiral/goridge/v3/pkg/socket" "go.uber.org/multierr" ) diff --git a/pkg/shared_memory/shm.go b/pkg/shared_memory/interface.go similarity index 100% rename from pkg/shared_memory/shm.go rename to pkg/shared_memory/interface.go diff --git a/pkg/shared_memory/posix_shm.go b/pkg/shared_memory/posix/posix_shm.go similarity index 99% rename from pkg/shared_memory/posix_shm.go rename to pkg/shared_memory/posix/posix_shm.go index 003ea4e..a9aa16c 100644 --- a/pkg/shared_memory/posix_shm.go +++ b/pkg/shared_memory/posix/posix_shm.go @@ -1,6 +1,6 @@ // +build linux -package shared_memory //nolint:golint,stylecheck +package posix //nolint:golint,stylecheck import ( "errors" diff --git a/pkg/shared_memory/posix_shm_test.go b/pkg/shared_memory/posix/posix_shm_test.go similarity index 98% rename from pkg/shared_memory/posix_shm_test.go rename to pkg/shared_memory/posix/posix_shm_test.go index 10879dd..c2efba5 100644 --- a/pkg/shared_memory/posix_shm_test.go +++ b/pkg/shared_memory/posix/posix_shm_test.go @@ -1,6 +1,6 @@ // +build linux -package shared_memory //nolint:golint,stylecheck +package posix //nolint:golint,stylecheck import ( "testing" diff --git a/pkg/shared_memory/shm_windows.go b/pkg/shared_memory/windows/shm_windows.go similarity index 98% rename from pkg/shared_memory/shm_windows.go rename to pkg/shared_memory/windows/shm_windows.go index cb80d11..bd6bdd8 100644 --- a/pkg/shared_memory/shm_windows.go +++ b/pkg/shared_memory/windows/shm_windows.go @@ -1,6 +1,6 @@ // +build windows -package shared_memory //nolint:golint +package windows //nolint:golint import ( "errors" diff --git a/pkg/shared_memory/shm_windows_test.go b/pkg/shared_memory/windows/shm_windows_test.go similarity index 95% rename from pkg/shared_memory/shm_windows_test.go rename to pkg/shared_memory/windows/shm_windows_test.go index 0054a19..c848f8d 100755 --- a/pkg/shared_memory/shm_windows_test.go +++ b/pkg/shared_memory/windows/shm_windows_test.go @@ -1,6 +1,6 @@ // +build windows -package shared_memory //nolint:golint +package windows //nolint:golint import ( "testing" diff --git a/pkg/socket/socket.go b/pkg/socket/socket.go index 59496fb..808d855 100644 --- a/pkg/socket/socket.go +++ b/pkg/socket/socket.go @@ -4,7 +4,6 @@ import ( "io" "github.com/spiral/errors" - "github.com/spiral/goridge/v3/interfaces/relay" "github.com/spiral/goridge/v3/internal" "github.com/spiral/goridge/v3/pkg/frame" ) @@ -15,7 +14,7 @@ type Relay struct { } // NewSocketRelay creates new socket based data relay. -func NewSocketRelay(rwc io.ReadWriteCloser) relay.Relay { +func NewSocketRelay(rwc io.ReadWriteCloser) *Relay { return &Relay{rwc: rwc} } From 4aab834e504a9a91d0016786485501673617c8cf Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Sat, 6 Feb 2021 16:49:49 +0300 Subject: [PATCH 2/4] Remove unused nolint directives --- pkg/shared_memory/posix/posix_shm.go | 2 +- pkg/shared_memory/posix/posix_shm_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/shared_memory/posix/posix_shm.go b/pkg/shared_memory/posix/posix_shm.go index a9aa16c..d3daded 100644 --- a/pkg/shared_memory/posix/posix_shm.go +++ b/pkg/shared_memory/posix/posix_shm.go @@ -1,6 +1,6 @@ // +build linux -package posix //nolint:golint,stylecheck +package posix import ( "errors" diff --git a/pkg/shared_memory/posix/posix_shm_test.go b/pkg/shared_memory/posix/posix_shm_test.go index c2efba5..ae7da2c 100644 --- a/pkg/shared_memory/posix/posix_shm_test.go +++ b/pkg/shared_memory/posix/posix_shm_test.go @@ -1,6 +1,6 @@ // +build linux -package posix //nolint:golint,stylecheck +package posix import ( "testing" From 2d18682a121f87461cd3815d2357a6fcd55be5b9 Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Sat, 6 Feb 2021 17:42:17 +0300 Subject: [PATCH 3/4] Correct README --- CHANGELOG.md | 41 +++++++++++++++++++++++++++++++++-------- README.md | 23 ++++++++++++++++++++--- 2 files changed, 53 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dea482..d5449de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,90 +2,112 @@ CHANGELOG ========= ### v3.0.1 (06.02.2021) + - Move relay interface to the pkg folder. - Separate CI into Linux, MacOS, Windows and Linters. +- Correct README.md (Installation and sample) - Add PR template. - Add dependabot. ### v3.0.0 (18.01.2021) + - New protocol (pkg/frame/frame.md) - Various payloads support: msgpack, raw bytes, JSON, gob. - New repo architecture. - Shared memory [alfa]. ### v2.4.6 (21.10.2020) + - Remove RawMessage check for the payload (@wolfy-j) - golang version in go.mod bumped to 1.15 ## v2.4.2 (19.05.2020) + - Add phpstan analyzer - Fix code warnings from phpstan -- Improve Relay factory and SocketRelay +- Improve Relay factory and SocketRelay - Improve test coverage - Performance improvements - See the full milestone here: [link](https://github.com/spiral/goridge/milestone/5?closed=1) ## v2.4.0 (05.05.2020) + - More tests for PHP (@vvval) - Upgrade PHP version to the 7.2 (currently minimum supported) -- Add new RelayInterface [link](https://github.com/spiral/goridge/pull/56/files#diff-85a3f483116946b4093f21ad855af4a8) (@vvval) +- Add new RelayInterface [link](https://github.com/spiral/goridge/pull/56/files#diff-85a3f483116946b4093f21ad855af4a8) ( + @vvval) - See the full milestone here: [link](https://github.com/spiral/goridge/issues?q=is%3Aclosed+milestone%3A2.4.0) ## v2.3.1 (21.04.2020) -- Syscall usage optimized. Now the data is packing and sending via 1 (or 2 in some cases) send_socket calls, instead of 2-3 (by @vvval) + +- Syscall usage optimized. Now the data is packing and sending via 1 (or 2 in some cases) send_socket calls, instead of + 2-3 (by @vvval) - Unix sockets supported on windows (AF_UNIX) starting from OS Build 17056. - Add the ability to define own relay with a codec (by @Reasno) ## v2.3.0 (23.03.2020) -- Replace std encoding/json package with the https://github.com/json-iterator/go + +- Replace std encoding/json package with the https://github.com/json-iterator/go - Add BORS and GHA support - golang modules updated to v2 ## v2.2.1 (30.11.2019) -- Fixed too strict StreamRelay check by @tarampampam + +- Fixed too strict StreamRelay check by @tarampampam ## v2.2.0 (29.11.2019) + - Update travis to support go 1.13 - Update tests (errors handling, simplify) - Add go modules support - Optimize pack function -by @ValeryPiashchynski +by @ValeryPiashchynski ## v2.1.4 (01.04.2019) + - minor performance improvements by @zloyuser - removed nighly from travis ## v2.1.3 (30.09.2018) + - improved performance (reduced number of syscalls required for Send command) ## v2.1.2 (07.06.2018) + - added 8 more bytes to the payload - added error detection mechanism over binary masks - added panic handler for pipe relay ## v2.1.0 (03.06.2018) + - added golang ClientCodec implementation - additional error detections - added sequence support - more tests ## v2.0.5 (03.04.2018) + - handled possible panic on reading from broken connection in socket relay ## v2.0.4 (23.03.2018) + - minor performance improvement in memory allocation for buffer by @243083df ## v2.0.3 (20.02.2018) + - fixed unix socket support on MacOS by @bgetsug ## v2.0.2 (29.01.2018) + - typo in SOCK_TPC constant ## v2.0.1 (23.01.2018) + - support sending empty string payloads without PAYLOAD_NONE flag ## v2.0.0 (17.11.2017) + - ext-sockets is not required anymore - Connection renamed to Relay - JsonRPC renamed to RPC @@ -94,7 +116,7 @@ by @ValeryPiashchynski - Added ability to invoke PHP from Go - Added control headers to manage execution flow - CLOSE_CONNECTION and KEEP_CONNECTION constants are removed -- \*\_BODY constants renamed to PAYLOAD\_\* to comply with .go code +- \*\_BODY constants renamed to PAYLOAD\_\* to comply with .go code - Protocol is extracted from Codec as independent abstraction - Simplified RPC Codec implementation - Code is formatted to comply to Golint @@ -103,11 +125,14 @@ by @ValeryPiashchynski - More error checks in PHP code - License holder moved from Spiral Framework to SpiralScout -## v1.0.4 +## v1.0.4 + - library dependency downgraded to support PHP7.0 by @thePanz ## v1.0.1 (14.08.2017) + - service level exception for invalid json payloads ## v1.0.0 (14.08.2017) + - public Goridge release diff --git a/README.md b/README.md index 3c37eb8..90986bd 100644 --- a/README.md +++ b/README.md @@ -39,10 +39,26 @@ Features Installation ------------ +Just import `gordge` to your package and run `go mod download`: + +```go +import ( + "github.com/spiral/goridge/v3" +) ``` -$ go get -u github.com/spiral/goridge/v3 +And add it to your `go.mod` + +```go +module github.com/spiral/roadrunner/v2 + +go 1.15 + +require ( + github.com/spiral/goridge/v3 v3.0.0 +) ``` +### Sample of usage ```go package main @@ -51,7 +67,7 @@ import ( "net" "net/rpc" - "github.com/spiral/goridge/v3" + goridgeRpc "github.com/spiral/goridge/v3/pkg/rpc" ) type App struct{} @@ -74,7 +90,8 @@ func main() { if err != nil { continue } - go rpc.ServeCodec(goridge.NewCodec(conn)) + _ = conn + go rpc.ServeCodec(goridgeRpc.NewCodec(conn)) } } ``` From 8cdca849a41f472d5cc20ea65e564b7cccc7252e Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Sat, 6 Feb 2021 19:57:15 +0300 Subject: [PATCH 4/4] Update README --- README.md | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/README.md b/README.md index 90986bd..3c7aad9 100644 --- a/README.md +++ b/README.md @@ -39,23 +39,8 @@ Features Installation ------------ -Just import `gordge` to your package and run `go mod download`: - ```go -import ( - "github.com/spiral/goridge/v3" -) -``` -And add it to your `go.mod` - -```go -module github.com/spiral/roadrunner/v2 - -go 1.15 - -require ( - github.com/spiral/goridge/v3 v3.0.0 -) +GO111MODULE=on go get github.com/spiral/goridge/v3 ``` ### Sample of usage