From a87d0ab1c19f67f2baa8dfff6880cf38c836f739 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 00:43:15 +0300 Subject: [PATCH 01/23] update deps Signed-off-by: Vasiliy Tolstov --- go.mod | 5 ++--- go.sum | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index e82ed741..55853a55 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,9 @@ module go.unistack.org/micro/v3 -go 1.16 +go 1.19 require ( - github.com/imdario/mergo v0.3.13 + github.com/imdario/mergo v0.3.14 github.com/patrickmn/go-cache v2.1.0+incompatible github.com/silas/dag v0.0.0-20211117232152-9d50aa809f35 - gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 60067f79..40151841 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,9 @@ -github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= -github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= +github.com/imdario/mergo v0.3.14 h1:fOqeC1+nCuuk6PKQdg9YmosXX7Y7mHX6R/0ZldI9iHo= +github.com/imdario/mergo v0.3.14/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/silas/dag v0.0.0-20211117232152-9d50aa809f35 h1:4mohWoM/UGg1BvFFiqSPRl5uwJY3rVV0HQX0ETqauqQ= github.com/silas/dag v0.0.0-20211117232152-9d50aa809f35/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 70ea93e466298f9e8041be20a53bc3995a726724 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 13:12:10 +0300 Subject: [PATCH 02/23] actions Signed-off-by: Vasiliy Tolstov --- .../ISSUE_TEMPLATE/bug_report.md | 0 .../feature-request---enhancement.md | 0 .../ISSUE_TEMPLATE/question.md | 0 {.github => .gitea}/PULL_REQUEST_TEMPLATE.md | 0 {.github => .gitea}/dependabot.yml | 0 .gitea/workflows/autoapprove.yml | 28 +++++++ {.github => .gitea}/workflows/automerge.yml | 0 {.github => .gitea}/workflows/build.yml | 0 {.github => .gitea}/workflows/codecov.yml | 0 .../workflows/codeql-analysis.yml | 0 .../workflows/dependabot-automerge.yml | 0 {.github => .gitea}/workflows/pr.yml | 0 .github.old/ISSUE_TEMPLATE/bug_report.md | 24 ++++++ .../feature-request---enhancement.md | 17 ++++ .github.old/ISSUE_TEMPLATE/question.md | 14 ++++ .github.old/PULL_REQUEST_TEMPLATE.md | 9 +++ .github.old/dependabot.yml | 26 +++++++ .../workflows/autoapprove.yml | 0 .github.old/workflows/automerge.yml | 21 +++++ .github.old/workflows/build.yml | 47 +++++++++++ .github.old/workflows/codecov.yml | 39 ++++++++++ .github.old/workflows/codeql-analysis.yml | 78 +++++++++++++++++++ .../workflows/dependabot-automerge.yml | 27 +++++++ .github.old/workflows/pr.yml | 47 +++++++++++ 24 files changed, 377 insertions(+) rename {.github => .gitea}/ISSUE_TEMPLATE/bug_report.md (100%) rename {.github => .gitea}/ISSUE_TEMPLATE/feature-request---enhancement.md (100%) rename {.github => .gitea}/ISSUE_TEMPLATE/question.md (100%) rename {.github => .gitea}/PULL_REQUEST_TEMPLATE.md (100%) rename {.github => .gitea}/dependabot.yml (100%) create mode 100644 .gitea/workflows/autoapprove.yml rename {.github => .gitea}/workflows/automerge.yml (100%) rename {.github => .gitea}/workflows/build.yml (100%) rename {.github => .gitea}/workflows/codecov.yml (100%) rename {.github => .gitea}/workflows/codeql-analysis.yml (100%) rename {.github => .gitea}/workflows/dependabot-automerge.yml (100%) rename {.github => .gitea}/workflows/pr.yml (100%) create mode 100644 .github.old/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github.old/ISSUE_TEMPLATE/feature-request---enhancement.md create mode 100644 .github.old/ISSUE_TEMPLATE/question.md create mode 100644 .github.old/PULL_REQUEST_TEMPLATE.md create mode 100644 .github.old/dependabot.yml rename {.github => .github.old}/workflows/autoapprove.yml (100%) create mode 100644 .github.old/workflows/automerge.yml create mode 100644 .github.old/workflows/build.yml create mode 100644 .github.old/workflows/codecov.yml create mode 100644 .github.old/workflows/codeql-analysis.yml create mode 100644 .github.old/workflows/dependabot-automerge.yml create mode 100644 .github.old/workflows/pr.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.gitea/ISSUE_TEMPLATE/bug_report.md similarity index 100% rename from .github/ISSUE_TEMPLATE/bug_report.md rename to .gitea/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/feature-request---enhancement.md b/.gitea/ISSUE_TEMPLATE/feature-request---enhancement.md similarity index 100% rename from .github/ISSUE_TEMPLATE/feature-request---enhancement.md rename to .gitea/ISSUE_TEMPLATE/feature-request---enhancement.md diff --git a/.github/ISSUE_TEMPLATE/question.md b/.gitea/ISSUE_TEMPLATE/question.md similarity index 100% rename from .github/ISSUE_TEMPLATE/question.md rename to .gitea/ISSUE_TEMPLATE/question.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.gitea/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from .github/PULL_REQUEST_TEMPLATE.md rename to .gitea/PULL_REQUEST_TEMPLATE.md diff --git a/.github/dependabot.yml b/.gitea/dependabot.yml similarity index 100% rename from .github/dependabot.yml rename to .gitea/dependabot.yml diff --git a/.gitea/workflows/autoapprove.yml b/.gitea/workflows/autoapprove.yml new file mode 100644 index 00000000..ef43e490 --- /dev/null +++ b/.gitea/workflows/autoapprove.yml @@ -0,0 +1,28 @@ +name: "autoapprove" + +on: + pull_request_target: + types: [assigned, opened, synchronize, reopened] + workflow_run: + workflows: ["prbuild"] + types: + - completed + +permissions: + pull-requests: write + contents: write + +jobs: + autoapprove: + runs-on: ubuntu-latest + steps: + - name: approve + run: [ "curl -o tea https://dl.gitea.com/tea/main/tea-main-linux-amd64", + "chmod +x ./tea", + "./tea login add --name unistack --token ${{ secrets.GITHUB_TOKEN }} --url https://git.unistack.org", + "./tea pr --repo ${{ github.event.repository.name }}" + ] + if: github.actor == 'vtolstov' + id: approve + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/automerge.yml b/.gitea/workflows/automerge.yml similarity index 100% rename from .github/workflows/automerge.yml rename to .gitea/workflows/automerge.yml diff --git a/.github/workflows/build.yml b/.gitea/workflows/build.yml similarity index 100% rename from .github/workflows/build.yml rename to .gitea/workflows/build.yml diff --git a/.github/workflows/codecov.yml b/.gitea/workflows/codecov.yml similarity index 100% rename from .github/workflows/codecov.yml rename to .gitea/workflows/codecov.yml diff --git a/.github/workflows/codeql-analysis.yml b/.gitea/workflows/codeql-analysis.yml similarity index 100% rename from .github/workflows/codeql-analysis.yml rename to .gitea/workflows/codeql-analysis.yml diff --git a/.github/workflows/dependabot-automerge.yml b/.gitea/workflows/dependabot-automerge.yml similarity index 100% rename from .github/workflows/dependabot-automerge.yml rename to .gitea/workflows/dependabot-automerge.yml diff --git a/.github/workflows/pr.yml b/.gitea/workflows/pr.yml similarity index 100% rename from .github/workflows/pr.yml rename to .gitea/workflows/pr.yml diff --git a/.github.old/ISSUE_TEMPLATE/bug_report.md b/.github.old/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..1899438a --- /dev/null +++ b/.github.old/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,24 @@ +--- +name: Bug report +about: For reporting bugs in go-micro +title: "[BUG]" +labels: '' +assignees: '' + +--- + +**Describe the bug** + +1. What are you trying to do? +2. What did you expect to happen? +3. What happens instead? + +**How to reproduce the bug:** + +If possible, please include a minimal code snippet here. + +**Environment:** +Go Version: please paste `go version` output here +``` +please paste `go env` output here +``` diff --git a/.github.old/ISSUE_TEMPLATE/feature-request---enhancement.md b/.github.old/ISSUE_TEMPLATE/feature-request---enhancement.md new file mode 100644 index 00000000..459817f4 --- /dev/null +++ b/.github.old/ISSUE_TEMPLATE/feature-request---enhancement.md @@ -0,0 +1,17 @@ +--- +name: Feature request / Enhancement +about: If you have a need not served by go-micro +title: "[FEATURE]" +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github.old/ISSUE_TEMPLATE/question.md b/.github.old/ISSUE_TEMPLATE/question.md new file mode 100644 index 00000000..1daf48b6 --- /dev/null +++ b/.github.old/ISSUE_TEMPLATE/question.md @@ -0,0 +1,14 @@ +--- +name: Question +about: Ask a question about go-micro +title: '' +labels: '' +assignees: '' + +--- + +Before asking, please check if your question has already been answered: + +1. Check the documentation - https://micro.mu/docs/ +2. Check the examples and plugins - https://github.com/micro/examples & https://github.com/micro/go-plugins +3. Search existing issues diff --git a/.github.old/PULL_REQUEST_TEMPLATE.md b/.github.old/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..cba3cbcc --- /dev/null +++ b/.github.old/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,9 @@ +## Pull Request template +Please, go through these steps before clicking submit on this PR. + +1. Give a descriptive title to your PR. +2. Provide a description of your changes. +3. Make sure you have some relevant tests. +4. Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if applicable). + +**PLEASE REMOVE THIS TEMPLATE BEFORE SUBMITTING** diff --git a/.github.old/dependabot.yml b/.github.old/dependabot.yml new file mode 100644 index 00000000..6df9d3f3 --- /dev/null +++ b/.github.old/dependabot.yml @@ -0,0 +1,26 @@ +# 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: + + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + commit-message: + prefix: "chore" + include: "scope" + + # Maintain dependencies for Golang + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "daily" + commit-message: + prefix: "chore" + include: "scope" + diff --git a/.github/workflows/autoapprove.yml b/.github.old/workflows/autoapprove.yml similarity index 100% rename from .github/workflows/autoapprove.yml rename to .github.old/workflows/autoapprove.yml diff --git a/.github.old/workflows/automerge.yml b/.github.old/workflows/automerge.yml new file mode 100644 index 00000000..5ff3f699 --- /dev/null +++ b/.github.old/workflows/automerge.yml @@ -0,0 +1,21 @@ +name: "automerge" + +on: + pull_request_target: + types: [assigned, opened, synchronize, reopened] + +permissions: + pull-requests: write + contents: write + +jobs: + automerge: + runs-on: ubuntu-latest + if: github.actor == 'vtolstov' + steps: + - name: merge + id: merge + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.TOKEN}} diff --git a/.github.old/workflows/build.yml b/.github.old/workflows/build.yml new file mode 100644 index 00000000..9603352d --- /dev/null +++ b/.github.old/workflows/build.yml @@ -0,0 +1,47 @@ +name: build +on: + push: + branches: + - master + - v3 +jobs: + test: + name: test + runs-on: ubuntu-latest + steps: + - name: setup + uses: actions/setup-go@v3 + with: + go-version: 1.17 + - name: checkout + uses: actions/checkout@v3 + - name: cache + uses: actions/cache@v3 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-go- + - name: deps + run: go get -v -t -d ./... + - name: test + env: + INTEGRATION_TESTS: yes + run: go test -mod readonly -v ./... + lint: + name: lint + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: lint + uses: golangci/golangci-lint-action@v3.4.0 + continue-on-error: true + with: + # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. + version: v1.30 + # Optional: working directory, useful for monorepos + # working-directory: somedir + # Optional: golangci-lint command line arguments. + # args: --issues-exit-code=0 + # Optional: show only new issues if it's a pull request. The default value is `false`. + # only-new-issues: true diff --git a/.github.old/workflows/codecov.yml b/.github.old/workflows/codecov.yml new file mode 100644 index 00000000..0b3e76f6 --- /dev/null +++ b/.github.old/workflows/codecov.yml @@ -0,0 +1,39 @@ +name: "codecov" + +on: + workflow_run: + workflows: ["build"] + types: + - completed + push: + branches: [ v3 ] + pull_request: + branches: [ v3 ] + schedule: + - cron: '34 1 * * 0' + +jobs: + codecov: + name: codecov + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup + uses: actions/setup-go@v3 + with: + go-version: 1.17 + - name: Run coverage + run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./... + - name: codecov + uses: codecov/codecov-action@v3.1.1 diff --git a/.github.old/workflows/codeql-analysis.yml b/.github.old/workflows/codeql-analysis.yml new file mode 100644 index 00000000..2f6c6dea --- /dev/null +++ b/.github.old/workflows/codeql-analysis.yml @@ -0,0 +1,78 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "codeql" + +on: + workflow_run: + workflows: ["prbuild"] + types: + - completed + push: + branches: [ master, v3 ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master, v3 ] + schedule: + - cron: '34 1 * * 0' + +jobs: + analyze: + name: analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup + uses: actions/setup-go@v3 + with: + go-version: 1.17 + # Initializes the CodeQL tools for scanning. + - name: init + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: analyze + uses: github/codeql-action/analyze@v2 diff --git a/.github.old/workflows/dependabot-automerge.yml b/.github.old/workflows/dependabot-automerge.yml new file mode 100644 index 00000000..f41c1c03 --- /dev/null +++ b/.github.old/workflows/dependabot-automerge.yml @@ -0,0 +1,27 @@ +name: "dependabot-automerge" + +on: + pull_request_target: + types: [assigned, opened, synchronize, reopened] + +permissions: + pull-requests: write + contents: write + +jobs: + automerge: + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' + steps: + - name: metadata + id: metadata + uses: dependabot/fetch-metadata@v1.3.6 + with: + github-token: "${{ secrets.TOKEN }}" + - name: merge + id: merge + if: ${{contains(steps.metadata.outputs.dependency-names, 'go.unistack.org')}} + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.TOKEN}} diff --git a/.github.old/workflows/pr.yml b/.github.old/workflows/pr.yml new file mode 100644 index 00000000..f313ebe8 --- /dev/null +++ b/.github.old/workflows/pr.yml @@ -0,0 +1,47 @@ +name: prbuild +on: + pull_request: + branches: + - master + - v3 +jobs: + test: + name: test + runs-on: ubuntu-latest + steps: + - name: setup + uses: actions/setup-go@v3 + with: + go-version: 1.17 + - name: checkout + uses: actions/checkout@v3 + - name: cache + uses: actions/cache@v3 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-go- + - name: deps + run: go get -v -t -d ./... + - name: test + env: + INTEGRATION_TESTS: yes + run: go test -mod readonly -v ./... + lint: + name: lint + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: lint + uses: golangci/golangci-lint-action@v3.4.0 + continue-on-error: true + with: + # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. + version: v1.30 + # Optional: working directory, useful for monorepos + # working-directory: somedir + # Optional: golangci-lint command line arguments. + # args: --issues-exit-code=0 + # Optional: show only new issues if it's a pull request. The default value is `false`. + # only-new-issues: true From 2710c269a8ddc06b58ae98b512a09f92aee5a02c Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 13:21:59 +0300 Subject: [PATCH 03/23] actions Signed-off-by: Vasiliy Tolstov --- .gitea/dependabot.yml | 26 -------- .gitea/workflows/automerge.yml | 21 ------ .gitea/workflows/build.yml | 47 -------------- .gitea/workflows/codecov.yml | 39 ------------ .gitea/workflows/codeql-analysis.yml | 78 ----------------------- .gitea/workflows/dependabot-automerge.yml | 27 -------- .gitea/workflows/pr.yml | 20 +----- 7 files changed, 1 insertion(+), 257 deletions(-) delete mode 100644 .gitea/dependabot.yml delete mode 100644 .gitea/workflows/automerge.yml delete mode 100644 .gitea/workflows/build.yml delete mode 100644 .gitea/workflows/codecov.yml delete mode 100644 .gitea/workflows/codeql-analysis.yml delete mode 100644 .gitea/workflows/dependabot-automerge.yml diff --git a/.gitea/dependabot.yml b/.gitea/dependabot.yml deleted file mode 100644 index 6df9d3f3..00000000 --- a/.gitea/dependabot.yml +++ /dev/null @@ -1,26 +0,0 @@ -# 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: - - # Maintain dependencies for GitHub Actions - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "daily" - commit-message: - prefix: "chore" - include: "scope" - - # Maintain dependencies for Golang - - package-ecosystem: "gomod" - directory: "/" - schedule: - interval: "daily" - commit-message: - prefix: "chore" - include: "scope" - diff --git a/.gitea/workflows/automerge.yml b/.gitea/workflows/automerge.yml deleted file mode 100644 index 5ff3f699..00000000 --- a/.gitea/workflows/automerge.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: "automerge" - -on: - pull_request_target: - types: [assigned, opened, synchronize, reopened] - -permissions: - pull-requests: write - contents: write - -jobs: - automerge: - runs-on: ubuntu-latest - if: github.actor == 'vtolstov' - steps: - - name: merge - id: merge - run: gh pr merge --auto --merge "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.TOKEN}} diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml deleted file mode 100644 index 9603352d..00000000 --- a/.gitea/workflows/build.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: build -on: - push: - branches: - - master - - v3 -jobs: - test: - name: test - runs-on: ubuntu-latest - steps: - - name: setup - uses: actions/setup-go@v3 - with: - go-version: 1.17 - - name: checkout - uses: actions/checkout@v3 - - name: cache - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: ${{ runner.os }}-go- - - name: deps - run: go get -v -t -d ./... - - name: test - env: - INTEGRATION_TESTS: yes - run: go test -mod readonly -v ./... - lint: - name: lint - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3 - - name: lint - uses: golangci/golangci-lint-action@v3.4.0 - continue-on-error: true - with: - # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.30 - # Optional: working directory, useful for monorepos - # working-directory: somedir - # Optional: golangci-lint command line arguments. - # args: --issues-exit-code=0 - # Optional: show only new issues if it's a pull request. The default value is `false`. - # only-new-issues: true diff --git a/.gitea/workflows/codecov.yml b/.gitea/workflows/codecov.yml deleted file mode 100644 index 0b3e76f6..00000000 --- a/.gitea/workflows/codecov.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: "codecov" - -on: - workflow_run: - workflows: ["build"] - types: - - completed - push: - branches: [ v3 ] - pull_request: - branches: [ v3 ] - schedule: - - cron: '34 1 * * 0' - -jobs: - codecov: - name: codecov - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'go' ] - - steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup - uses: actions/setup-go@v3 - with: - go-version: 1.17 - - name: Run coverage - run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./... - - name: codecov - uses: codecov/codecov-action@v3.1.1 diff --git a/.gitea/workflows/codeql-analysis.yml b/.gitea/workflows/codeql-analysis.yml deleted file mode 100644 index 2f6c6dea..00000000 --- a/.gitea/workflows/codeql-analysis.yml +++ /dev/null @@ -1,78 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "codeql" - -on: - workflow_run: - workflows: ["prbuild"] - types: - - completed - push: - branches: [ master, v3 ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master, v3 ] - schedule: - - cron: '34 1 * * 0' - -jobs: - analyze: - name: analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'go' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup - uses: actions/setup-go@v3 - with: - go-version: 1.17 - # Initializes the CodeQL tools for scanning. - - name: init - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: autobuild - uses: github/codeql-action/autobuild@v2 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: analyze - uses: github/codeql-action/analyze@v2 diff --git a/.gitea/workflows/dependabot-automerge.yml b/.gitea/workflows/dependabot-automerge.yml deleted file mode 100644 index f41c1c03..00000000 --- a/.gitea/workflows/dependabot-automerge.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: "dependabot-automerge" - -on: - pull_request_target: - types: [assigned, opened, synchronize, reopened] - -permissions: - pull-requests: write - contents: write - -jobs: - automerge: - runs-on: ubuntu-latest - if: github.actor == 'dependabot[bot]' - steps: - - name: metadata - id: metadata - uses: dependabot/fetch-metadata@v1.3.6 - with: - github-token: "${{ secrets.TOKEN }}" - - name: merge - id: merge - if: ${{contains(steps.metadata.outputs.dependency-names, 'go.unistack.org')}} - run: gh pr merge --auto --merge "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.TOKEN}} diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml index f313ebe8..29653a47 100644 --- a/.gitea/workflows/pr.yml +++ b/.gitea/workflows/pr.yml @@ -26,22 +26,4 @@ jobs: - name: test env: INTEGRATION_TESTS: yes - run: go test -mod readonly -v ./... - lint: - name: lint - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3 - - name: lint - uses: golangci/golangci-lint-action@v3.4.0 - continue-on-error: true - with: - # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.30 - # Optional: working directory, useful for monorepos - # working-directory: somedir - # Optional: golangci-lint command line arguments. - # args: --issues-exit-code=0 - # Optional: show only new issues if it's a pull request. The default value is `false`. - # only-new-issues: true + run: go test -mod readonly -v ./... \ No newline at end of file From 8fddaa04554e13aa6b0c2df597a6c9fbcfcf348b Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 13:26:42 +0300 Subject: [PATCH 04/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/{workflows => }/autoapprove.yml | 0 .gitea/workflows/pr.yml | 8 +------- 2 files changed, 1 insertion(+), 7 deletions(-) rename .gitea/{workflows => }/autoapprove.yml (100%) diff --git a/.gitea/workflows/autoapprove.yml b/.gitea/autoapprove.yml similarity index 100% rename from .gitea/workflows/autoapprove.yml rename to .gitea/autoapprove.yml diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml index 29653a47..1ef8dcbb 100644 --- a/.gitea/workflows/pr.yml +++ b/.gitea/workflows/pr.yml @@ -12,15 +12,9 @@ jobs: - name: setup uses: actions/setup-go@v3 with: - go-version: 1.17 + go-version: 1.19 - name: checkout uses: actions/checkout@v3 - - name: cache - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: ${{ runner.os }}-go- - name: deps run: go get -v -t -d ./... - name: test From b4f0c3e29aa4dac51b22a44c249461637c042c51 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 13:29:21 +0300 Subject: [PATCH 05/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml index 1ef8dcbb..823b3ade 100644 --- a/.gitea/workflows/pr.yml +++ b/.gitea/workflows/pr.yml @@ -10,11 +10,11 @@ jobs: runs-on: ubuntu-latest steps: - name: setup - uses: actions/setup-go@v3 + uses: actions/setup-go with: go-version: 1.19 - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout - name: deps run: go get -v -t -d ./... - name: test From bd0c309b71ad8e4adcc548b587613ae23ba98d2a Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 13:38:39 +0300 Subject: [PATCH 06/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/pr.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml index 823b3ade..c9206e9f 100644 --- a/.gitea/workflows/pr.yml +++ b/.gitea/workflows/pr.yml @@ -10,11 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - name: setup - uses: actions/setup-go - with: - go-version: 1.19 + uses: https://gitea.com/actions/setup-go@v3 - name: checkout - uses: actions/checkout + uses: https://gitea.com/actions/checkout@v3 - name: deps run: go get -v -t -d ./... - name: test From 8e5015e5800e24a9a064cc386e01bf6878631e30 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 13:41:59 +0300 Subject: [PATCH 07/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/pr.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml index c9206e9f..461f7a97 100644 --- a/.gitea/workflows/pr.yml +++ b/.gitea/workflows/pr.yml @@ -11,6 +11,8 @@ jobs: steps: - name: setup uses: https://gitea.com/actions/setup-go@v3 + with: + go-version: 1.18 - name: checkout uses: https://gitea.com/actions/checkout@v3 - name: deps From dfd1da7f0d46d14d6a15ca98632e7471b3ce288b Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 14:26:03 +0300 Subject: [PATCH 08/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/lint.yml | 31 +++++++++++++++++++++++++++++++ .gitea/workflows/pr.yml | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/lint.yml diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml new file mode 100644 index 00000000..fe0cd583 --- /dev/null +++ b/.gitea/workflows/lint.yml @@ -0,0 +1,31 @@ +name: lint +on: + pull_request: + branches: + - master + - v3 +jobs: + lint: + name: lint + runs-on: ubuntu-latest + steps: + - name: setup + uses: https://gitea.com/actions/setup-go@v3 + with: + go-version: 1.18 + - name: checkout + uses: https://gitea.com/actions/checkout@v3 + - name: deps + run: go get -v -d ./... + - name: lint + uses: https://github.com/golangci/golangci-lint-action@v3.4.0 + continue-on-error: true + with: + # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. + version: v1.30 + # Optional: working directory, useful for monorepos + # working-directory: somedir + # Optional: golangci-lint command line arguments. + # args: --issues-exit-code=0 + # Optional: show only new issues if it's a pull request. The default value is `false`. + # only-new-issues: true diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml index 461f7a97..fdab548f 100644 --- a/.gitea/workflows/pr.yml +++ b/.gitea/workflows/pr.yml @@ -1,4 +1,4 @@ -name: prbuild +name: pr on: pull_request: branches: From 384e4d113d66bb454c8c4d1ea854caec81f58d3f Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 14:43:23 +0300 Subject: [PATCH 09/23] retest Signed-off-by: Vasiliy Tolstov --- .github.old/workflows/pr.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github.old/workflows/pr.yml b/.github.old/workflows/pr.yml index f313ebe8..c03221c3 100644 --- a/.github.old/workflows/pr.yml +++ b/.github.old/workflows/pr.yml @@ -37,11 +37,4 @@ jobs: uses: golangci/golangci-lint-action@v3.4.0 continue-on-error: true with: - # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.30 - # Optional: working directory, useful for monorepos - # working-directory: somedir - # Optional: golangci-lint command line arguments. - # args: --issues-exit-code=0 - # Optional: show only new issues if it's a pull request. The default value is `false`. - # only-new-issues: true + version: v1.30 \ No newline at end of file From da5d50db5bfa46e991ee24b9af15c3695281f1f2 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 14:48:27 +0300 Subject: [PATCH 10/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/ISSUE_TEMPLATE/bug_report.md | 2 +- .gitea/ISSUE_TEMPLATE/feature-request---enhancement.md | 4 ++-- .gitea/ISSUE_TEMPLATE/question.md | 10 ++-------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.gitea/ISSUE_TEMPLATE/bug_report.md b/.gitea/ISSUE_TEMPLATE/bug_report.md index 1899438a..b10170c9 100644 --- a/.gitea/ISSUE_TEMPLATE/bug_report.md +++ b/.gitea/ISSUE_TEMPLATE/bug_report.md @@ -1,6 +1,6 @@ --- name: Bug report -about: For reporting bugs in go-micro +about: For reporting bugs in micro title: "[BUG]" labels: '' assignees: '' diff --git a/.gitea/ISSUE_TEMPLATE/feature-request---enhancement.md b/.gitea/ISSUE_TEMPLATE/feature-request---enhancement.md index 459817f4..c722ea6f 100644 --- a/.gitea/ISSUE_TEMPLATE/feature-request---enhancement.md +++ b/.gitea/ISSUE_TEMPLATE/feature-request---enhancement.md @@ -1,6 +1,6 @@ --- name: Feature request / Enhancement -about: If you have a need not served by go-micro +about: If you have a need not served by micro title: "[FEATURE]" labels: '' assignees: '' @@ -14,4 +14,4 @@ A clear and concise description of what the problem is. Ex. I'm always frustrate A clear and concise description of what you want to happen. **Additional context** -Add any other context or screenshots about the feature request here. +Add any other context or screenshots about the feature request here. \ No newline at end of file diff --git a/.gitea/ISSUE_TEMPLATE/question.md b/.gitea/ISSUE_TEMPLATE/question.md index 1daf48b6..3d65c721 100644 --- a/.gitea/ISSUE_TEMPLATE/question.md +++ b/.gitea/ISSUE_TEMPLATE/question.md @@ -1,14 +1,8 @@ --- name: Question -about: Ask a question about go-micro +about: Ask a question about micro title: '' labels: '' assignees: '' ---- - -Before asking, please check if your question has already been answered: - -1. Check the documentation - https://micro.mu/docs/ -2. Check the examples and plugins - https://github.com/micro/examples & https://github.com/micro/go-plugins -3. Search existing issues +--- \ No newline at end of file From 258812304a41f97cec4e889824c80159287bc78f Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 15:12:32 +0300 Subject: [PATCH 11/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/ISSUE_TEMPLATE/bug_report.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.gitea/ISSUE_TEMPLATE/bug_report.md b/.gitea/ISSUE_TEMPLATE/bug_report.md index b10170c9..a77fdfdf 100644 --- a/.gitea/ISSUE_TEMPLATE/bug_report.md +++ b/.gitea/ISSUE_TEMPLATE/bug_report.md @@ -16,9 +16,3 @@ assignees: '' **How to reproduce the bug:** If possible, please include a minimal code snippet here. - -**Environment:** -Go Version: please paste `go version` output here -``` -please paste `go env` output here -``` From 078069b2d7a4e9d16a6fe6f62e14659ebf5ae0c0 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 16:01:27 +0300 Subject: [PATCH 12/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/lint.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index fe0cd583..7eed0d4c 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -21,11 +21,4 @@ jobs: uses: https://github.com/golangci/golangci-lint-action@v3.4.0 continue-on-error: true with: - # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.30 - # Optional: working directory, useful for monorepos - # working-directory: somedir - # Optional: golangci-lint command line arguments. - # args: --issues-exit-code=0 - # Optional: show only new issues if it's a pull request. The default value is `false`. - # only-new-issues: true From 15aac48f1e3e898432aeb106258155979432e6aa Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 16:08:51 +0300 Subject: [PATCH 13/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/lint.yml | 10 +++++++--- .gitea/workflows/pr.yml | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 7eed0d4c..3ef926a9 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -9,12 +9,16 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - name: setup + - name: checkout + uses: https://gitea.com/actions/checkout@v3 + - name: setup-node + uses: https://gitea.com/actions/setup-node@v3 + with: + node-version: 18 + - name: setup-go uses: https://gitea.com/actions/setup-go@v3 with: go-version: 1.18 - - name: checkout - uses: https://gitea.com/actions/checkout@v3 - name: deps run: go get -v -d ./... - name: lint diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml index fdab548f..7ebd89e6 100644 --- a/.gitea/workflows/pr.yml +++ b/.gitea/workflows/pr.yml @@ -9,12 +9,16 @@ jobs: name: test runs-on: ubuntu-latest steps: - - name: setup + - name: checkout + uses: https://gitea.com/actions/checkout@v3 + - name: setup-node + uses: https://gitea.com/actions/setup-node@v3 + with: + node-version: 18 + - name: setup-go uses: https://gitea.com/actions/setup-go@v3 with: go-version: 1.18 - - name: checkout - uses: https://gitea.com/actions/checkout@v3 - name: deps run: go get -v -t -d ./... - name: test From a51b8b810289cc4a19096fde35d3a10eac30dee0 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 16:11:52 +0300 Subject: [PATCH 14/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/lint.yml | 8 ++++---- .gitea/workflows/pr.yml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 3ef926a9..5c944cdd 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -9,16 +9,16 @@ jobs: name: lint runs-on: ubuntu-latest steps: + - name: setup-go + uses: https://gitea.com/actions/setup-go@v3 + with: + go-version: 1.18 - name: checkout uses: https://gitea.com/actions/checkout@v3 - name: setup-node uses: https://gitea.com/actions/setup-node@v3 with: node-version: 18 - - name: setup-go - uses: https://gitea.com/actions/setup-go@v3 - with: - go-version: 1.18 - name: deps run: go get -v -d ./... - name: lint diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml index 7ebd89e6..0247bac0 100644 --- a/.gitea/workflows/pr.yml +++ b/.gitea/workflows/pr.yml @@ -9,12 +9,12 @@ jobs: name: test runs-on: ubuntu-latest steps: - - name: checkout - uses: https://gitea.com/actions/checkout@v3 - name: setup-node uses: https://gitea.com/actions/setup-node@v3 with: node-version: 18 + - name: checkout + uses: https://gitea.com/actions/checkout@v3 - name: setup-go uses: https://gitea.com/actions/setup-go@v3 with: From 46ef49176452ddb2b10ebec56641c2e1710532e4 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 16:17:44 +0300 Subject: [PATCH 15/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/lint.yml | 6 +----- .gitea/workflows/pr.yml | 4 ---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 5c944cdd..71803244 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -15,14 +15,10 @@ jobs: go-version: 1.18 - name: checkout uses: https://gitea.com/actions/checkout@v3 - - name: setup-node - uses: https://gitea.com/actions/setup-node@v3 - with: - node-version: 18 - name: deps run: go get -v -d ./... - name: lint uses: https://github.com/golangci/golangci-lint-action@v3.4.0 continue-on-error: true with: - version: v1.30 + version: v1.52 diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml index 0247bac0..ba947f0c 100644 --- a/.gitea/workflows/pr.yml +++ b/.gitea/workflows/pr.yml @@ -9,10 +9,6 @@ jobs: name: test runs-on: ubuntu-latest steps: - - name: setup-node - uses: https://gitea.com/actions/setup-node@v3 - with: - node-version: 18 - name: checkout uses: https://gitea.com/actions/checkout@v3 - name: setup-go From 50d60b58259ccda786a679024bf7d5cfd094677c Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 16:24:47 +0300 Subject: [PATCH 16/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 71803244..612525e7 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -22,3 +22,4 @@ jobs: continue-on-error: true with: version: v1.52 + From cf4cac0733327701d0c3a76b0794e6f4b7fc7bcc Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 16:29:58 +0300 Subject: [PATCH 17/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/lint.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 612525e7..71803244 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -22,4 +22,3 @@ jobs: continue-on-error: true with: version: v1.52 - From 45ebef5544e1693dc46836bb5e2dd9e2c0390dc9 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 16:31:42 +0300 Subject: [PATCH 18/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 71803244..612525e7 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -22,3 +22,4 @@ jobs: continue-on-error: true with: version: v1.52 + From 7b8f4410fb8e2408b17c040bfcc9e0bfc91314a3 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 16:36:38 +0300 Subject: [PATCH 19/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/lint.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 612525e7..9e531446 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -22,4 +22,5 @@ jobs: continue-on-error: true with: version: v1.52 - + + From 2dbada0e9466e916492c01716deaeba1957f9470 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 16:43:33 +0300 Subject: [PATCH 20/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/lint.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 9e531446..8da88945 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -21,6 +21,4 @@ jobs: uses: https://github.com/golangci/golangci-lint-action@v3.4.0 continue-on-error: true with: - version: v1.52 - - + version: v1.52 \ No newline at end of file From 00c2c749db28dfc0916d4f6d3b3232f8b2defa91 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 16:46:41 +0300 Subject: [PATCH 21/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/lint.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 8da88945..e407ed45 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -21,4 +21,5 @@ jobs: uses: https://github.com/golangci/golangci-lint-action@v3.4.0 continue-on-error: true with: - version: v1.52 \ No newline at end of file + version: v1.52 + \ No newline at end of file From 646212cc08aedf21c2555336f5b456e9962b927f Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 19 Mar 2023 17:09:40 +0300 Subject: [PATCH 22/23] retest Signed-off-by: Vasiliy Tolstov --- .gitea/workflows/lint.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index e407ed45..8da88945 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -21,5 +21,4 @@ jobs: uses: https://github.com/golangci/golangci-lint-action@v3.4.0 continue-on-error: true with: - version: v1.52 - \ No newline at end of file + version: v1.52 \ No newline at end of file From 270d26f1aee32bc9338df740102ad747f627a471 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Fri, 24 Mar 2023 00:25:47 +0300 Subject: [PATCH 23/23] test Signed-off-by: Vasiliy Tolstov --- options.go | 3 ++ options/hooks.go | 31 +++++++++++++++++++++ options/hooks_test.go | 65 +++++++++++++++++++++++++++++++++++++++++++ server/options.go | 3 ++ 4 files changed, 102 insertions(+) create mode 100644 options/hooks.go create mode 100644 options/hooks_test.go diff --git a/options.go b/options.go index 95636364..37164a71 100644 --- a/options.go +++ b/options.go @@ -211,6 +211,7 @@ func Stores(s ...store.Store) Option { } // Logger set the logger to use +// //nolint:gocyclo func Logger(l logger.Logger, opts ...LoggerOption) Option { return func(o *Options) error { @@ -329,6 +330,7 @@ func Meters(m ...meter.Meter) Option { // Register sets the register for the service // and the underlying components +// //nolint:gocyclo func Register(r register.Register, opts ...RegisterOption) Option { return func(o *Options) error { @@ -403,6 +405,7 @@ func RegisterBroker(n string) RegisterOption { } // Tracer sets the tracer +// //nolint:gocyclo func Tracer(t tracer.Tracer, opts ...TracerOption) Option { return func(o *Options) error { diff --git a/options/hooks.go b/options/hooks.go new file mode 100644 index 00000000..48a45ad2 --- /dev/null +++ b/options/hooks.go @@ -0,0 +1,31 @@ +package options // import "go.unistack.org/micro/v3/options" + +// Hook func interface +type Hook interface{} + +// Hooks func slice +type Hooks []Hook + +// Append is used to add hooks +func (hs *Hooks) Append(h ...Hook) { + *hs = append(*hs, h...) +} + +// Replace is used to set hooks +func (hs *Hooks) Replace(h ...Hook) { + *hs = h +} + +// EachNext is used to itearate over hooks forward +func (hs *Hooks) EachNext(fn func(Hook)) { + for idx := 0; idx < len(*hs); idx++ { + fn((*hs)[idx]) + } +} + +// EachPrev is used to iterate over hooks backward +func (hs *Hooks) EachPrev(fn func(Hook)) { + for idx := len(*hs) - 1; idx >= 0; idx-- { + fn((*hs)[idx]) + } +} diff --git a/options/hooks_test.go b/options/hooks_test.go new file mode 100644 index 00000000..be84d3bd --- /dev/null +++ b/options/hooks_test.go @@ -0,0 +1,65 @@ +package options + +import "testing" + +func TestHooks_Append(t *testing.T) { + fn1 := func() {} + fn2 := func() {} + hs := &Hooks{} + hs.Append(fn1, fn2) + if len(*hs) != 2 { + t.Fatalf("unexpected Append error") + } +} + +func TestHooks_Replace(t *testing.T) { + fn1 := func() {} + fn2 := func() {} + hs := &Hooks{} + hs.Append(fn1, fn2, fn1) + if len(*hs) != 3 { + t.Fatalf("unexpected Append error") + } + hs.Replace(fn1, fn2) + if len(*hs) != 2 { + t.Fatalf("unexpected Replace error") + } +} + +func TestHooks_EachNext(t *testing.T) { + n := 5 + fn1 := func() { + n *= 2 + } + fn2 := func() { + n -= 10 + } + hs := &Hooks{} + hs.Append(fn1, fn2) + + hs.EachNext(func(h Hook) { + h.(func())() + }) + if n != 0 { + t.Fatalf("unexpected EachNext") + } +} + +func TestHooks_EachPrev(t *testing.T) { + n := 5 + fn1 := func() { + n *= 2 + } + fn2 := func() { + n -= 10 + } + hs := &Hooks{} + hs.Append(fn2, fn1) + + hs.EachPrev(func(h Hook) { + h.(func())() + }) + if n != 0 { + t.Fatalf("unexpected EachPrev") + } +} diff --git a/server/options.go b/server/options.go index cf269772..8ab8c0d2 100644 --- a/server/options.go +++ b/server/options.go @@ -13,6 +13,7 @@ import ( "go.unistack.org/micro/v3/metadata" "go.unistack.org/micro/v3/meter" "go.unistack.org/micro/v3/network/transport" + "go.unistack.org/micro/v3/options" "go.unistack.org/micro/v3/register" "go.unistack.org/micro/v3/tracer" "go.unistack.org/micro/v3/util/id" @@ -83,6 +84,8 @@ type Options struct { MaxConn int // DeregisterAttempts holds the number of deregister attempts before error DeregisterAttempts int + // Hooks may contains SubscriberWrapper, HandlerWrapper or Server func wrapper + Hooks options.Hooks } // NewOptions returns new options struct with default or passed values