diff --git a/.gitea/ISSUE_TEMPLATE/question.md b/.gitea/ISSUE_TEMPLATE/question.md deleted file mode 100644 index 3d65c72..0000000 --- a/.gitea/ISSUE_TEMPLATE/question.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: Question -about: Ask a question about micro -title: '' -labels: '' -assignees: '' - ---- \ No newline at end of file diff --git a/.gitea/ISSUE_TEMPLATE/bug_report.md b/.github.old/ISSUE_TEMPLATE/bug_report.md similarity index 64% rename from .gitea/ISSUE_TEMPLATE/bug_report.md rename to .github.old/ISSUE_TEMPLATE/bug_report.md index a77fdfd..1899438 100644 --- a/.gitea/ISSUE_TEMPLATE/bug_report.md +++ b/.github.old/ISSUE_TEMPLATE/bug_report.md @@ -1,6 +1,6 @@ --- name: Bug report -about: For reporting bugs in micro +about: For reporting bugs in go-micro title: "[BUG]" labels: '' assignees: '' @@ -16,3 +16,9 @@ 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 +``` diff --git a/.gitea/ISSUE_TEMPLATE/feature-request---enhancement.md b/.github.old/ISSUE_TEMPLATE/feature-request---enhancement.md similarity index 88% rename from .gitea/ISSUE_TEMPLATE/feature-request---enhancement.md rename to .github.old/ISSUE_TEMPLATE/feature-request---enhancement.md index c722ea6..459817f 100644 --- a/.gitea/ISSUE_TEMPLATE/feature-request---enhancement.md +++ b/.github.old/ISSUE_TEMPLATE/feature-request---enhancement.md @@ -1,6 +1,6 @@ --- name: Feature request / Enhancement -about: If you have a need not served by micro +about: If you have a need not served by go-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. \ No newline at end of file +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 0000000..1daf48b --- /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/.gitea/PULL_REQUEST_TEMPLATE.md b/.github.old/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from .gitea/PULL_REQUEST_TEMPLATE.md rename to .github.old/PULL_REQUEST_TEMPLATE.md diff --git a/.github/dependabot.yml b/.github.old/dependabot.yml similarity index 100% rename from .github/dependabot.yml rename to .github.old/dependabot.yml 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/workflows/automerge.yml b/.github.old/workflows/automerge.yml similarity index 100% rename from .github/workflows/automerge.yml rename to .github.old/workflows/automerge.yml diff --git a/.github/workflows/build.yml b/.github.old/workflows/build.yml similarity index 100% rename from .github/workflows/build.yml rename to .github.old/workflows/build.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github.old/workflows/codeql-analysis.yml similarity index 100% rename from .github/workflows/codeql-analysis.yml rename to .github.old/workflows/codeql-analysis.yml diff --git a/.github/workflows/dependabot-automerge.yml b/.github.old/workflows/dependabot-automerge.yml similarity index 100% rename from .github/workflows/dependabot-automerge.yml rename to .github.old/workflows/dependabot-automerge.yml diff --git a/.github/workflows/pr.yml b/.github.old/workflows/pr.yml similarity index 100% rename from .github/workflows/pr.yml rename to .github.old/workflows/pr.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 1899438..a77fdfd 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/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: '' @@ -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 -``` diff --git a/.github/ISSUE_TEMPLATE/feature-request---enhancement.md b/.github/ISSUE_TEMPLATE/feature-request---enhancement.md index 459817f..c722ea6 100644 --- a/.github/ISSUE_TEMPLATE/feature-request---enhancement.md +++ b/.github/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/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index 1daf48b..3d65c72 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/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 diff --git a/.gitea/autoapprove.yml b/.github/autoapprove.yml similarity index 100% rename from .gitea/autoapprove.yml rename to .github/autoapprove.yml diff --git a/.github/workflows/job_coverage.yml b/.github/workflows/job_coverage.yml new file mode 100644 index 0000000..3238e77 --- /dev/null +++ b/.github/workflows/job_coverage.yml @@ -0,0 +1,53 @@ +name: coverage + +on: + push: + branches: [ main, v3, v4 ] + paths-ignore: + - '.github/**' + - '.gitea/**' + pull_request: + branches: [ main, v3, v4 ] + +jobs: + + build: + if: github.server_url != 'https://github.com' + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v4 + with: + filter: 'blob:none' + + - name: setup go + uses: actions/setup-go@v5 + with: + cache-dependency-path: "**/*.sum" + go-version: 'stable' + + - name: test coverage + run: | + go test -v -cover ./... -covermode=count -coverprofile coverage.out -coverpkg ./... + go tool cover -func coverage.out -o coverage.out + + - name: coverage badge + uses: tj-actions/coverage-badge-go@v2 + with: + green: 80 + filename: coverage.out + + - uses: stefanzweifel/git-auto-commit-action@v4 + name: autocommit + with: + commit_message: Apply Code Coverage Badge + skip_fetch: false + skip_checkout: false + file_pattern: ./README.md + + - name: push + if: steps.auto-commit-action.outputs.changes_detected == 'true' + uses: ad-m/github-push-action@master + with: + github_token: ${{ github.token }} + branch: ${{ github.ref }} diff --git a/.gitea/workflows/job_lint.yml b/.github/workflows/job_lint.yml similarity index 72% rename from .gitea/workflows/job_lint.yml rename to .github/workflows/job_lint.yml index d97e747..1c104db 100644 --- a/.gitea/workflows/job_lint.yml +++ b/.github/workflows/job_lint.yml @@ -3,10 +3,10 @@ name: lint on: pull_request: types: [opened, reopened, synchronize] - branches: - - master - - v3 - - v4 + branches: [ master, v3, v4 ] + paths-ignore: + - '.github/**' + - '.gitea/**' jobs: lint: @@ -20,10 +20,10 @@ jobs: uses: actions/setup-go@v5 with: cache-dependency-path: "**/*.sum" - go-version: 'stable' + go-version: 'stable' - name: setup deps run: go get -v ./... - name: run lint - uses: https://github.com/golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v6 with: version: 'latest' diff --git a/.gitea/workflows/job_test.yml b/.github/workflows/job_test.yml similarity index 80% rename from .gitea/workflows/job_test.yml rename to .github/workflows/job_test.yml index f68cbca..59a95ae 100644 --- a/.gitea/workflows/job_test.yml +++ b/.github/workflows/job_test.yml @@ -3,15 +3,12 @@ name: test on: pull_request: types: [opened, reopened, synchronize] - branches: - - master - - v3 - - v4 + branches: [ master, v3, v4 ] push: - branches: - - master - - v3 - - v4 + branches: [ master, v3, v4 ] + paths-ignore: + - '.github/**' + - '.gitea/**' jobs: test: diff --git a/.gitea/workflows/job_tests.yml b/.github/workflows/job_tests.yml similarity index 75% rename from .gitea/workflows/job_tests.yml rename to .github/workflows/job_tests.yml index e8984f1..9af2291 100644 --- a/.gitea/workflows/job_tests.yml +++ b/.github/workflows/job_tests.yml @@ -3,15 +3,12 @@ name: test on: pull_request: types: [opened, reopened, synchronize] - branches: - - master - - v3 - - v4 + branches: [ master, v3, v4 ] push: - branches: - - master - - v3 - - v4 + branches: [ master, v3, v4 ] + paths-ignore: + - '.github/**' + - '.gitea/**' jobs: test: @@ -35,19 +32,19 @@ jobs: go-version: 'stable' - name: setup go work env: - GOWORK: /workspace/${{ github.repository_owner }}/go.work + GOWORK: ${{ github.workspace }}/go.work run: | go work init go work use . go work use micro-tests - name: setup deps env: - GOWORK: /workspace/${{ github.repository_owner }}/go.work + GOWORK: ${{ github.workspace }}/go.work run: go get -v ./... - name: run tests env: INTEGRATION_TESTS: yes - GOWORK: /workspace/${{ github.repository_owner }}/go.work + GOWORK: ${{ github.workspace }}/go.work run: | cd micro-tests go test -mod readonly -v ./... || true diff --git a/.golangci.yml b/.golangci.yml index 6ff842d..393bfc3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,27 +1,18 @@ run: concurrency: 4 - deadline: 5m + timeout: 5m issues-exit-code: 1 tests: true -linters-settings: - govet: - check-shadowing: true - enable: - - fieldalignment - linters: enable: - govet - - deadcode - errcheck - govet - ineffassign - staticcheck - - structcheck - typecheck - unused - - varcheck - bodyclose - gci - goconst @@ -30,7 +21,6 @@ linters: - gofmt - gofumpt - goimports - - golint - gosec - makezero - misspell diff --git a/README.md b/README.md index 8b0db0c..a9fe944 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # TCP Server +![Coverage](https://img.shields.io/badge/Coverage-0.0%25-red) -The TCP micro.Server implemtation. It's a partial implementation which strips out codecs, transports, etc but enables you +The TCP micro.Server implemtation. It's a partial implementation which strips out codecs, transports, etc but enables you to create a TCP Server that could potentially be used for some TCP based API services. ## Usage - diff --git a/message.go b/message.go index 135d2ba..bf03610 100644 --- a/message.go +++ b/message.go @@ -14,7 +14,7 @@ type tcpMessage struct { header metadata.Metadata topic string contentType string - body []byte + body []byte //nolint:unused } func (r *tcpMessage) Topic() string { diff --git a/options.go b/options.go index 7ccd9a3..6b88360 100644 --- a/options.go +++ b/options.go @@ -18,10 +18,8 @@ type ( netListener struct{} ) -// // MaxMsgSize set the maximum message in bytes the server can receive and // send. Default maximum message size is 8K -// func MaxMsgSize(s int) server.Option { return server.SetOption(maxMsgSizeKey{}, s) } diff --git a/tcp.go b/tcp.go index eac6839..c271e7b 100644 --- a/tcp.go +++ b/tcp.go @@ -468,7 +468,7 @@ func (h *Server) serve(ln net.Listener, hd Handler) { return default: } - if ne, ok := err.(net.Error); ok && ne.Temporary() { + if ne, ok := err.(net.Error); ok && ne.Temporary() { //nolint:staticcheck if tempDelay == 0 { tempDelay = 5 * time.Millisecond } else {