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/.github/workflows/autoapprove.yml b/.gitea/workflows/autoapprove.yml similarity index 100% rename from .github/workflows/autoapprove.yml rename to .gitea/workflows/autoapprove.yml 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/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/.gitea/workflows/job_lint.yml b/.gitea/workflows/job_lint.yml new file mode 100644 index 0000000..acfc4ed --- /dev/null +++ b/.gitea/workflows/job_lint.yml @@ -0,0 +1,28 @@ +name: lint + +on: + pull_request: + types: [opened, reopened, synchronize] + branches: + - master + - v3 + - v4 + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + with: + filter: 'blob:none' + - name: setup-go + uses: actions/setup-go@v5 + with: + go-version: 'stable' + - name: deps + run: go get -v -d ./... + - name: lint + uses: https://github.com/golangci/golangci-lint-action@v6 + with: + version: 'latest' diff --git a/.gitea/workflows/job_test.yml b/.gitea/workflows/job_test.yml new file mode 100644 index 0000000..0840a4f --- /dev/null +++ b/.gitea/workflows/job_test.yml @@ -0,0 +1,33 @@ +name: test + +on: + pull_request: + types: [opened, reopened, synchronize] + branches: + - master + - v3 + - v4 + push: + branches: + - master + - v3 + - v4 + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + with: + filter: 'blob:none' + - name: setup-go + uses: actions/setup-go@v5 + with: + go-version: 'stable' + - name: deps + run: go get -v -d ./... + - name: test + env: + INTEGRATION_TESTS: yes + run: go test -mod readonly -v ./... diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 9603352..0000000 --- a/.github/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/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index f313ebe..0000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,47 +0,0 @@ -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 diff --git a/.golangci.yml b/.golangci.yml index 6ff842d..2bb1c30 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,44 +1,5 @@ run: - concurrency: 4 + concurrency: 8 deadline: 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 - - gocritic - - gosimple - - gofmt - - gofumpt - - goimports - - golint - - gosec - - makezero - - misspell - - nakedret - - nestif - - nilerr - - noctx - - prealloc - - unconvert - - unparam - disable-all: false diff --git a/README.md b/README.md index a32fab6..ddfc0b2 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ to create a HTTP Server that could potentially be used for REST based API servic import ( "net/http" - "github.com/unistack-org/micro/v3/server" - httpServer "github.com/unistack-org/micro-server-http" + "go.unistack.org/micro/v4/server" + httpServer "go.unistack.org/micro-server-http/v4" ) func main() { @@ -37,9 +37,9 @@ Or as part of a service import ( "net/http" - "github.com/unistack-org/micro/v3" - "github.com/unistack-org/micro/v3/server" - httpServer "github.com/unistack-org/micro-server-http" + "go.unistack.org/micro/v4" + "go.unistack.org/micro/v4/server" + httpServer "go.unistack.org/micro-server-http/v4" ) func main() { diff --git a/go.mod b/go.mod index 69106de..b79c692 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,27 @@ -module go.unistack.org/micro-server-http/v3 +module go.unistack.org/micro-server-http/v4 +<<<<<<< HEAD +go 1.19 + +require ( + go.unistack.org/micro-codec-yaml/v4 v4.0.0 + go.unistack.org/micro-proto/v4 v4.0.1 + go.unistack.org/micro/v4 v4.0.17 + go.unistack.org/protoc-gen-go-micro/v4 v4.0.13 + golang.org/x/net v0.22.0 +) + +require ( + github.com/fatih/structtag v1.2.0 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/gnostic v0.7.0 // indirect + github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect + golang.org/x/mod v0.16.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/tools v0.19.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect +======= go 1.22.7 toolchain go1.23.3 @@ -19,5 +41,7 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 // indirect google.golang.org/grpc v1.68.0 // indirect google.golang.org/protobuf v1.35.2 // indirect +>>>>>>> rem/v3 gopkg.in/yaml.v3 v3.0.1 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index bd8c582..90effc0 100644 --- a/go.sum +++ b/go.sum @@ -171,7 +171,10 @@ cloud.google.com/go/compute v1.14.0/go.mod h1:YfLtxrj9sU4Yxv+sXzZkyPjEyPBZfXHUvj cloud.google.com/go/compute v1.15.1/go.mod h1:bjjoF/NtFUrkD/urWfdHaKuOPDR5nWIs63rR+SXhcpA= cloud.google.com/go/compute v1.18.0/go.mod h1:1X7yHxec2Ga+Ss6jPyjxRxpu2uu7PLgsOVXvgU0yacs= cloud.google.com/go/compute v1.19.0/go.mod h1:rikpw2y+UMidAe9tISo04EHNOIf42RLYF/q8Bs93scU= +<<<<<<< HEAD +======= cloud.google.com/go/compute v1.19.1/go.mod h1:6ylj3a05WF8leseCdIf77NK0g1ey+nj5IKd5/kvShxE= +>>>>>>> rem/v3 cloud.google.com/go/compute/metadata v0.1.0/go.mod h1:Z1VN+bulIf6bt4P/C37K4DyZYZEXYonfTBHHFPO/4UU= cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= @@ -592,13 +595,19 @@ cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoIS cloud.google.com/go/workflows v1.8.0/go.mod h1:ysGhmEajwZxGn1OhGOGKsTXc5PyxOc0vfKf5Af+to4M= cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT3ujaO/WwSA= cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcPALq2CxzdePw= +<<<<<<< HEAD +======= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +>>>>>>> rem/v3 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +<<<<<<< HEAD +======= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +>>>>>>> rem/v3 github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= @@ -635,9 +644,13 @@ github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20230105202645-06c439db220b/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +<<<<<<< HEAD +======= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +>>>>>>> rem/v3 github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 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/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -651,11 +664,19 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/go-control-plane v0.10.3/go.mod h1:fJJn/j26vwOu972OllsvAgJJM//w9BV6Fxbg2LuVd34= +<<<<<<< HEAD +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo= +github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0++PMirau2/yoOwVac3AbF2w= +github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= +github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= +======= github.com/envoyproxy/go-control-plane v0.11.1-0.20230524094728-9239064ad72f/go.mod h1:sfYdkwUW4BA3PbKjySwjJy+O4Pu0h62rlqCMHNk+K+Q= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo= github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0++PMirau2/yoOwVac3AbF2w= github.com/envoyproxy/protoc-gen-validate v0.10.1/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= +>>>>>>> rem/v3 github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= @@ -676,7 +697,10 @@ github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MG github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +<<<<<<< HEAD +======= github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= +>>>>>>> rem/v3 github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -706,12 +730,23 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +<<<<<<< HEAD +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +======= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +>>>>>>> rem/v3 github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +<<<<<<< HEAD +github.com/google/gnostic v0.6.9 h1:ZK/5VhkoX835RikCHpSUJV9a+S3e1zLh59YnyWeBW+0= +======= +>>>>>>> rem/v3 github.com/google/gnostic v0.6.9/go.mod h1:Nm8234We1lq6iB9OmlgNv3nH91XLLVZHCDayfA3xq+E= github.com/google/gnostic v0.7.0 h1:d7EpuFp8vVdML+y0JJJYiKeOLjKTdH/GvVkLOBWqJpw= github.com/google/gnostic v0.7.0/go.mod h1:IAcUyMl6vtC95f60EZ8oXyqTsOersP6HbwjeG7EyDPM= @@ -727,13 +762,20 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +<<<<<<< HEAD +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +======= +>>>>>>> rem/v3 github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +<<<<<<< HEAD +======= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +>>>>>>> rem/v3 github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -795,8 +837,13 @@ github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02 github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +<<<<<<< HEAD +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +======= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +>>>>>>> rem/v3 github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -804,13 +851,19 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= +<<<<<<< HEAD +======= github.com/lyft/protoc-gen-star/v2 v2.0.1/go.mod h1:RcCdONR2ScXaYnQC5tUzxzlpA3WVYF7/opLeUgcQs/o= +>>>>>>> rem/v3 github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE= +<<<<<<< HEAD +======= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= +>>>>>>> rem/v3 github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= github.com/phpdave11/gofpdi v1.0.13/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= @@ -823,16 +876,25 @@ github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qR 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/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +<<<<<<< HEAD +======= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +>>>>>>> rem/v3 github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +<<<<<<< HEAD +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= +github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk= +======= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk= github.com/silas/dag v0.0.0-20220518035006-a7e85ada93c5/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I= +>>>>>>> rem/v3 github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= @@ -850,7 +912,10 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +<<<<<<< HEAD +======= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +>>>>>>> rem/v3 github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= @@ -873,6 +938,18 @@ go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +<<<<<<< HEAD +go.unistack.org/micro-codec-yaml/v4 v4.0.0 h1:DK/+fA69gmnvYmGHe3kqVR0pukS8ank5lPG4MfdPQEk= +go.unistack.org/micro-codec-yaml/v4 v4.0.0/go.mod h1:UG4ouILbUfgNL7nvp7CpmD2IIzO8bQHjzDIahOvIAgM= +go.unistack.org/micro-proto/v4 v4.0.1 h1:2RKHgtCOOcAFgKsnngGK5bqM/6MWXOjVCdw03dbuoF8= +go.unistack.org/micro-proto/v4 v4.0.1/go.mod h1:ArmK7o+uFvxSY3dbJhKBBX4Pm1rhWdLEFf3LxBrMtec= +go.unistack.org/micro/v4 v4.0.17 h1:mF7uM+J4ILdG+1fcwzKYCwDlxhdbF/e1WnGzKKLnIXc= +go.unistack.org/micro/v4 v4.0.17/go.mod h1:ZDgU9931vm2l7X6RN/6UuwRIVp24GRdmQ7dKmegArk4= +go.unistack.org/protoc-gen-go-micro/v4 v4.0.7 h1:c3CeBvjWV9MBrGGPaQCcHZrnuLY9sVJHv7vACI/dvuM= +go.unistack.org/protoc-gen-go-micro/v4 v4.0.7/go.mod h1:9bsKAlESlPXPBSmY/NDLL//smZbhnEMrnWyG+M8zVFA= +go.unistack.org/protoc-gen-go-micro/v4 v4.0.13 h1:7iqOK75ErgGJK6c7SjL7rDy9DBv2IjSFw2OZx5waUo8= +go.unistack.org/protoc-gen-go-micro/v4 v4.0.13/go.mod h1:9bsKAlESlPXPBSmY/NDLL//smZbhnEMrnWyG+M8zVFA= +======= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.unistack.org/micro-client-http/v3 v3.9.13 h1:KUWkDfA7p+dZEIgSsWuPjfj6yeX8rrnHYwrEjdAZvmU= go.unistack.org/micro-client-http/v3 v3.9.13/go.mod h1:WmrmeWWKohGn5ODrCr53wUp4pe/ZE6UYdXh7ECgpOH4= @@ -887,6 +964,7 @@ go.unistack.org/micro/v3 v3.10.97 h1:8l7fv+i06/PjPrBBhRC/ZQkWGIOuHPg3jJN0vktYE78 go.unistack.org/micro/v3 v3.10.97/go.mod h1:YzMldzHN9Ei+zy5t/Psu7RUWDZwUfrNYiStSQtTz90g= go.unistack.org/micro/v3 v3.10.108 h1:3L7SkilMVLtH8y3pQIPtr3jjQYrf0AMv1oAkoL3nFkE= go.unistack.org/micro/v3 v3.10.108/go.mod h1:YzMldzHN9Ei+zy5t/Psu7RUWDZwUfrNYiStSQtTz90g= +>>>>>>> rem/v3 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -896,7 +974,10 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +<<<<<<< HEAD +======= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +>>>>>>> rem/v3 golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -953,7 +1034,14 @@ golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +<<<<<<< HEAD +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= +golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +======= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +>>>>>>> rem/v3 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-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1006,11 +1094,20 @@ golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +<<<<<<< HEAD +======= golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +>>>>>>> rem/v3 golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +<<<<<<< HEAD +golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +======= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= @@ -1018,6 +1115,7 @@ golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= +>>>>>>> rem/v3 golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1046,7 +1144,10 @@ golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec= golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= +<<<<<<< HEAD +======= golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= +>>>>>>> rem/v3 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-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1063,7 +1164,11 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +<<<<<<< HEAD +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +======= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +>>>>>>> rem/v3 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-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1136,6 +1241,21 @@ golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +<<<<<<< HEAD +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +======= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1157,6 +1277,7 @@ golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= +>>>>>>> rem/v3 golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1172,10 +1293,13 @@ golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +<<<<<<< HEAD +======= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +>>>>>>> rem/v3 golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1242,7 +1366,14 @@ golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +<<<<<<< HEAD +golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8= +golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= +golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= +golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= +======= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= +>>>>>>> rem/v3 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1461,11 +1592,14 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230525234020-1aefcd67740a/go. google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234015-3fc162c6f38a/go.mod h1:xURIpW9ES5+/GZhnV6beoEtxQrnkRGIfP5VQG2tCBLc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= +<<<<<<< HEAD +======= google.golang.org/genproto/googleapis/rpc v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc= google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 h1:LWZqQOEjDyONlF1H6afSWpAL/znlREo2tHfLoe+8LMA= google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= +>>>>>>> rem/v3 google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1503,6 +1637,10 @@ google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCD google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= +<<<<<<< HEAD +google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +======= google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= @@ -1511,6 +1649,7 @@ google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0= google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA= +>>>>>>> rem/v3 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= 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= @@ -1529,6 +1668,16 @@ google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +<<<<<<< HEAD +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +======= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= @@ -1539,10 +1688,16 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +>>>>>>> rem/v3 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +<<<<<<< HEAD +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +======= +>>>>>>> rem/v3 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -1594,3 +1749,10 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8 rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +<<<<<<< HEAD +sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= +======= +>>>>>>> rem/v3 diff --git a/handler.go b/handler.go index 7b3c1e4..32c5f8b 100644 --- a/handler.go +++ b/handler.go @@ -12,6 +12,15 @@ import ( "sync" "time" +<<<<<<< HEAD + "go.unistack.org/micro/v4/errors" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/register" + "go.unistack.org/micro/v4/server" + rhttp "go.unistack.org/micro/v4/util/http" + rflutil "go.unistack.org/micro/v4/util/reflect" +======= "go.unistack.org/micro/v3/errors" "go.unistack.org/micro/v3/logger" "go.unistack.org/micro/v3/metadata" @@ -23,13 +32,18 @@ import ( "go.unistack.org/micro/v3/tracer" rhttp "go.unistack.org/micro/v3/util/http" rflutil "go.unistack.org/micro/v3/util/reflect" +>>>>>>> rem/v3 ) var ( - DefaultErrorHandler = func(ctx context.Context, s server.Handler, w http.ResponseWriter, r *http.Request, err error, status int) { + DefaultErrorHandler = func(ctx context.Context, s interface{}, w http.ResponseWriter, r *http.Request, err error, status int) { w.WriteHeader(status) if _, cerr := w.Write([]byte(err.Error())); cerr != nil { +<<<<<<< HEAD + logger.DefaultLogger.Error(ctx, fmt.Sprintf("write failed: %v", cerr)) +======= logger.DefaultLogger.Error(ctx, "write error", cerr) +>>>>>>> rem/v3 } } DefaultContentType = "application/json" @@ -42,7 +56,7 @@ type patHandler struct { } type httpHandler struct { - opts server.HandlerOptions + opts server.HandleOptions hd interface{} handlers *rhttp.Trie name string @@ -63,7 +77,7 @@ func (h *httpHandler) Endpoints() []*register.Endpoint { return h.eps } -func (h *httpHandler) Options() server.HandlerOptions { +func (h *httpHandler) Options() server.HandleOptions { return h.opts } @@ -116,14 +130,22 @@ func (h *Server) HTTPHandlerFunc(handler interface{}) (http.HandlerFunc, error) md = metadata.New(len(r.Header) + 8) } for k, v := range r.Header { +<<<<<<< HEAD + md[k] = v[0] +======= md[k] = strings.Join(v, ", ") +>>>>>>> rem/v3 } md["RemoteAddr"] = r.RemoteAddr md["Method"] = r.Method md["URL"] = r.URL.String() md["Proto"] = r.Proto md["Content-Length"] = fmt.Sprintf("%d", r.ContentLength) +<<<<<<< HEAD + md["Transfer-Encoding"] = r.TransferEncoding[0] +======= md["Transfer-Encoding"] = strings.Join(r.TransferEncoding, ",") +>>>>>>> rem/v3 md["Host"] = r.Host md["RequestURI"] = r.RequestURI if r.TLS != nil { @@ -199,7 +221,12 @@ func (h *Server) HTTPHandlerFunc(handler interface{}) (http.HandlerFunc, error) cf, err := h.newCodec(ct) if err != nil { +<<<<<<< HEAD + w.WriteHeader(http.StatusBadRequest) + _, _ = w.Write([]byte(err.Error())) +======= w.WriteHeader(http.StatusUnsupportedMediaType) +>>>>>>> rem/v3 return } @@ -269,20 +296,32 @@ func (h *Server) HTTPHandlerFunc(handler interface{}) (http.HandlerFunc, error) } if nmd, ok := metadata.FromOutgoingContext(fctx); ok { for k, v := range nmd { +<<<<<<< HEAD + md[k] = v + } + } +======= md.Set(k, v) } } metadata.SetOutgoingContext(ctx, md) +>>>>>>> rem/v3 return err } // wrap the handler func +<<<<<<< HEAD + // for i := len(handler.sopts.Hooks); i > 0; i-- { + // fn = handler.sopts.Hooks[i-1](fn) + // } +======= h.opts.Hooks.EachNext(func(hook options.Hook) { if h, ok := hook.(server.HookHandler); ok { fn = h(fn) } }) +>>>>>>> rem/v3 if ct == "application/x-www-form-urlencoded" { cf, err = h.newCodec(DefaultContentType) @@ -299,19 +338,31 @@ func (h *Server) HTTPHandlerFunc(handler interface{}) (http.HandlerFunc, error) w.Header().Set(metadata.HeaderContentType, ct) if md, ok := metadata.FromOutgoingContext(ctx); ok { for k, v := range md { +<<<<<<< HEAD + w.Header()[k] = []string{v} +======= w.Header().Set(k, v) +>>>>>>> rem/v3 } } if md := getRspHeader(ctx); md != nil { for k, v := range md { +<<<<<<< HEAD + w.Header()[k] = v +======= for _, vv := range v { w.Header().Add(k, vv) } +>>>>>>> rem/v3 } } if nct := w.Header().Get(metadata.HeaderContentType); nct != ct { if cf, err = h.newCodec(nct); err != nil { +<<<<<<< HEAD + h.errorHandler(ctx, nil, w, r, err, http.StatusBadRequest) +======= h.errorHandler(ctx, nil, w, r, err, http.StatusInternalServerError) +>>>>>>> rem/v3 return } } @@ -332,7 +383,11 @@ func (h *Server) HTTPHandlerFunc(handler interface{}) (http.HandlerFunc, error) } if err != nil && handler.sopts.Logger.V(logger.ErrorLevel) { +<<<<<<< HEAD + handler.sopts.Logger.Error(handler.sopts.Context, fmt.Sprintf("handler err: %v", err)) +======= handler.sopts.Logger.Error(handler.sopts.Context, "handler error", err) +>>>>>>> rem/v3 return } @@ -342,7 +397,11 @@ func (h *Server) HTTPHandlerFunc(handler interface{}) (http.HandlerFunc, error) w.WriteHeader(scode) if _, cerr := w.Write(buf); cerr != nil { +<<<<<<< HEAD + handler.sopts.Logger.Error(ctx, fmt.Sprintf("write failed: %v", cerr)) +======= handler.sopts.Logger.Error(ctx, "write failed", cerr) +>>>>>>> rem/v3 } }, nil } @@ -363,7 +422,7 @@ func (h *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { md = metadata.New(len(r.Header) + 8) } for k, v := range r.Header { - md[k] = strings.Join(v, ", ") + md[k] = v[0] } md["RemoteAddr"] = r.RemoteAddr if r.TLS != nil { @@ -374,14 +433,23 @@ func (h *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { md["Method"] = r.Method md["URL"] = r.URL.String() md["Proto"] = r.Proto +<<<<<<< HEAD + md["Content-Length"] = fmt.Sprintf("%d", r.ContentLength) + if len(r.TransferEncoding) > 0 { + md["Transfer-Encoding"] = r.TransferEncoding[0] +======= md["ContentLength"] = fmt.Sprintf("%d", r.ContentLength) if len(r.TransferEncoding) > 0 { md["TransferEncoding"] = strings.Join(r.TransferEncoding, ",") +>>>>>>> rem/v3 } md["Host"] = r.Host md["RequestURI"] = r.RequestURI ctx = metadata.NewIncomingContext(ctx, md) +<<<<<<< HEAD +======= ctx = metadata.NewOutgoingContext(ctx, metadata.New(0)) +>>>>>>> rem/v3 path := r.URL.Path if !strings.HasPrefix(path, "/") { @@ -435,6 +503,10 @@ func (h *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { var sp tracer.Span if !match && h.hd != nil { +<<<<<<< HEAD + if hdlr, ok := h.hd.(http.Handler); ok { + hdlr.ServeHTTP(w, r) +======= if hdlr, ok := h.hd.Handler().(http.Handler); ok { endpointName := fmt.Sprintf("%s.%s", hldr.name, hldr.mtype.method.Name) if !slices.Contains(tracer.DefaultSkipEndpoints, endpointName) { @@ -471,10 +543,15 @@ func (h *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { } hdlr.ServeHTTP(w, r.WithContext(ctx)) +>>>>>>> rem/v3 return } } else if !match { // check for http.HandlerFunc handlers +<<<<<<< HEAD + if ph, _, err := h.pathHandlers.Search(r.Method, r.URL.Path); err == nil { + ph.(http.HandlerFunc)(w, r) +======= if !slices.Contains(tracer.DefaultSkipEndpoints, r.URL.Path) { ctx, sp = h.opts.Tracer.Start(ctx, "rpc-server", tracer.WithSpanKind(tracer.SpanKindServer), @@ -495,6 +572,7 @@ func (h *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { } if ph, _, err := h.pathHandlers.Search(r.Method, r.URL.Path); err == nil { ph.(http.HandlerFunc)(w, r.WithContext(ctx)) +>>>>>>> rem/v3 return } h.errorHandler(ctx, nil, w, r, fmt.Errorf("not matching route found"), http.StatusNotFound) @@ -633,10 +711,9 @@ func (h *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { } if nmd, ok := metadata.FromOutgoingContext(fctx); ok { for k, v := range nmd { - md.Set(k, v) + md[k] = v } } - metadata.SetOutgoingContext(ctx, md) if err != nil && sp != nil { sp.SetStatus(tracer.SpanStatusError, err.Error()) @@ -645,11 +722,18 @@ func (h *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { return err } +<<<<<<< HEAD + // wrap the handler func + // for i := len(handler.sopts.HdlrWrappers); i > 0; i-- { + // fn = handler.sopts.HdlrWrappers[i-1](fn) + // } +======= h.opts.Hooks.EachNext(func(hook options.Hook) { if h, ok := hook.(server.HookHandler); ok { fn = h(fn) } }) +>>>>>>> rem/v3 if ct == "application/x-www-form-urlencoded" { cf, err = h.newCodec(DefaultContentType) @@ -666,7 +750,7 @@ func (h *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.Header().Set(metadata.HeaderContentType, ct) if md, ok := metadata.FromOutgoingContext(ctx); ok { for k, v := range md { - w.Header().Set(k, v) + w.Header()[k] = []string{v} } } if md := getRspHeader(ctx); md != nil { @@ -698,18 +782,31 @@ func (h *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { buf, err = cf.Marshal(replyv.Interface()) } +<<<<<<< HEAD + if err != nil && handler.sopts.Logger.V(logger.ErrorLevel) { + handler.sopts.Logger.Error(handler.sopts.Context, fmt.Sprintf("handler err: %v", err)) + return + } + + if nscode := GetRspCode(ctx); nscode != 0 { +======= if err != nil { if handler.sopts.Logger.V(logger.ErrorLevel) { handler.sopts.Logger.Error(handler.sopts.Context, "handler error", err) } scode = http.StatusInternalServerError } else if nscode := GetRspCode(ctx); nscode != 0 { +>>>>>>> rem/v3 scode = nscode } w.WriteHeader(scode) if _, cerr := w.Write(buf); cerr != nil { +<<<<<<< HEAD + handler.sopts.Logger.Error(ctx, fmt.Sprintf("write failed: %v", cerr)) +======= handler.sopts.Logger.Error(ctx, "respoonse write error", cerr) +>>>>>>> rem/v3 } } diff --git a/handler/generate.go b/handler/generate.go index 8f8c5ed..26a389d 100644 --- a/handler/generate.go +++ b/handler/generate.go @@ -2,11 +2,21 @@ package handler import ( // import required packages +<<<<<<< HEAD + _ "go.unistack.org/micro-proto/v4/openapiv3" +======= _ "go.unistack.org/micro-proto/v3/openapiv3" +>>>>>>> rem/v3 ) //go:generate sh -c "curl -L https://github.com/swagger-api/swagger-ui/archive/refs/tags/v4.18.3.zip -o - | bsdtar -C swagger-ui --strip-components=2 -xv swagger-ui-4.18.3/dist && rm swagger-ui/*.map swagger-ui/*-es-*.js swagger-ui/swagger-ui.js swagger-ui/swagger-initializer.js" +<<<<<<< HEAD +//go:generate sh -c "protoc -I./ -I$(go list -f '{{ .Dir }}' -m go.unistack.org/micro-proto/v4) --go-micro_out='components=micro|http|server',standalone=false,debug=true,paths=source_relative:./ ./meter/meter.proto" + +//go:generate sh -c "protoc -I./ -I$(go list -f '{{ .Dir }}' -m go.unistack.org/micro-proto/v4) --go-micro_out='components=micro|http|server',standalone=false,debug=true,paths=source_relative:./ ./health/health.proto" +======= //go:generate sh -c "protoc -I./ -I$(go list -f '{{ .Dir }}' -m go.unistack.org/micro-proto/v3) --go-micro_out='components=micro|http|server',standalone=false,debug=true,paths=source_relative:./ ./meter/meter.proto" //go:generate sh -c "protoc -I./ -I$(go list -f '{{ .Dir }}' -m go.unistack.org/micro-proto/v3) --go-micro_out='components=micro|http|server',standalone=false,debug=true,paths=source_relative:./ ./health/health.proto" +>>>>>>> rem/v3 diff --git a/handler/health/health.go b/handler/health/health.go index 9731a0d..da36bfc 100644 --- a/handler/health/health.go +++ b/handler/health/health.go @@ -1,13 +1,17 @@ +<<<<<<< HEAD +package health // import "go.unistack.org/micro-server-http/v4/handler/health" +======= package health_handler +>>>>>>> rem/v3 import ( "context" - codecpb "go.unistack.org/micro-proto/v3/codec" - "go.unistack.org/micro/v3/errors" + codecpb "go.unistack.org/micro-proto/v4/codec" + "go.unistack.org/micro/v4/errors" ) -var _ HealthServiceServer = &Handler{} +var _ HealthServiceServer = (*Handler)(nil) type Handler struct { opts Options diff --git a/handler/health/health.proto b/handler/health/health.proto index 715e9b4..c664d3d 100644 --- a/handler/health/health.proto +++ b/handler/health/health.proto @@ -1,7 +1,12 @@ syntax = "proto3"; +<<<<<<< HEAD +package micro.server.http.v4.handler.health; +option go_package = "go.unistack.org/micro-server-http/v4/handler/health;health"; +======= package micro.server.http.v3.handler.health; option go_package = "go.unistack.org/micro-server-http/v3/handler/health;health_handler"; +>>>>>>> rem/v3 import "api/annotations.proto"; import "openapiv3/annotations.proto"; diff --git a/handler/health/health_micro.pb.go b/handler/health/health_micro.pb.go index 37ad339..5cd7095 100644 --- a/handler/health/health_micro.pb.go +++ b/handler/health/health_micro.pb.go @@ -1,20 +1,31 @@ // Code generated by protoc-gen-go-micro. DO NOT EDIT. // versions: +<<<<<<< HEAD +// - protoc-gen-go-micro v4.0.2 +// - protoc v4.23.4 +======= // - protoc-gen-go-micro v3.10.4 // - protoc v5.28.3 +>>>>>>> rem/v3 // source: health/health.proto package health_handler import ( context "context" +<<<<<<< HEAD + codec "go.unistack.org/micro-proto/v4/codec" +======= codec "go.unistack.org/micro-proto/v3/codec" client "go.unistack.org/micro/v3/client" +>>>>>>> rem/v3 ) var ( HealthServiceName = "HealthService" ) +<<<<<<< HEAD +======= type HealthServiceClient interface { Healthy(ctx context.Context, req *codec.Frame, opts ...client.CallOption) (*codec.Frame, error) @@ -22,6 +33,7 @@ type HealthServiceClient interface { Ready(ctx context.Context, req *codec.Frame, opts ...client.CallOption) (*codec.Frame, error) Version(ctx context.Context, req *codec.Frame, opts ...client.CallOption) (*codec.Frame, error) } +>>>>>>> rem/v3 type HealthServiceServer interface { Healthy(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error diff --git a/handler/health/health_micro_http.pb.go b/handler/health/health_micro_http.pb.go index b9ff281..6877346 100644 --- a/handler/health/health_micro_http.pb.go +++ b/handler/health/health_micro_http.pb.go @@ -1,17 +1,54 @@ // Code generated by protoc-gen-go-micro. DO NOT EDIT. +<<<<<<< HEAD +// protoc-gen-go-micro version: v4.0.2 +======= // protoc-gen-go-micro version: v3.10.4 +>>>>>>> rem/v3 // source: health/health.proto package health_handler import ( context "context" +<<<<<<< HEAD + codec "go.unistack.org/micro-proto/v4/codec" + v4 "go.unistack.org/micro-server-http/v4" + options "go.unistack.org/micro/v4/options" + server "go.unistack.org/micro/v4/server" +) + +var ( + HealthServiceServerEndpoints = []v4.EndpointMetadata{ + { + Name: "HealthService.Live", + Path: "/live", + Method: "GET", + Body: "", + Stream: false, + }, + { + Name: "HealthService.Ready", + Path: "/ready", + Method: "GET", + Body: "", + Stream: false, + }, + { + Name: "HealthService.Version", + Path: "/version", + Method: "GET", + Body: "", + Stream: false, + }, + } +======= v31 "go.unistack.org/micro-client-http/v3" codec "go.unistack.org/micro-proto/v3/codec" v3 "go.unistack.org/micro-server-http/v3" client "go.unistack.org/micro/v3/client" server "go.unistack.org/micro/v3/server" http "net/http" +>>>>>>> rem/v3 ) var ( @@ -169,7 +206,7 @@ func (h *healthServiceServer) Version(ctx context.Context, req *codec.Frame, rsp return h.HealthServiceServer.Version(ctx, req, rsp) } -func RegisterHealthServiceServer(s server.Server, sh HealthServiceServer, opts ...server.HandlerOption) error { +func RegisterHealthServiceServer(s server.Server, sh HealthServiceServer, opts ...options.Option) error { type healthService interface { Healthy(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error Live(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error @@ -180,7 +217,7 @@ func RegisterHealthServiceServer(s server.Server, sh HealthServiceServer, opts . healthService } h := &healthServiceServer{sh} - var nopts []server.HandlerOption - nopts = append(nopts, v3.HandlerEndpoints(HealthServiceServerEndpoints)) - return s.Handle(s.NewHandler(&HealthService{h}, append(nopts, opts...)...)) + var nopts []options.Option + nopts = append(nopts, v4.HandlerEndpoints(HealthServiceServerEndpoints)) + return s.Handle(&HealthService{h}, append(nopts, opts...)...) } diff --git a/handler/meter/meter.go b/handler/meter/meter.go index 737c115..924e3c3 100644 --- a/handler/meter/meter.go +++ b/handler/meter/meter.go @@ -1,4 +1,8 @@ +<<<<<<< HEAD +package meter // import "go.unistack.org/micro-server-http/v4/handler/meter" +======= package meter_handler +>>>>>>> rem/v3 import ( "bytes" @@ -8,10 +12,18 @@ import ( "strings" "sync" +<<<<<<< HEAD + codecpb "go.unistack.org/micro-proto/v4/codec" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/options" +======= codecpb "go.unistack.org/micro-proto/v3/codec" "go.unistack.org/micro/v3/logger" "go.unistack.org/micro/v3/metadata" "go.unistack.org/micro/v3/meter" +>>>>>>> rem/v3 ) const ( @@ -32,7 +44,7 @@ var bufPool = sync.Pool{ } // guard to fail early -var _ MeterServiceServer = &Handler{} +var _ MeterServiceServer = (*Handler)(nil) type Handler struct { Options Options @@ -43,7 +55,11 @@ type Option func(*Options) type Options struct { Meter meter.Meter Name string +<<<<<<< HEAD + MeterOptions []options.Option +======= MeterOptions []meter.Option +>>>>>>> rem/v3 DisableCompress bool } @@ -65,7 +81,11 @@ func DisableCompress(g bool) Option { } } +<<<<<<< HEAD +func MeterOptions(opts ...options.Option) Option { +======= func MeterOptions(opts ...meter.Option) Option { +>>>>>>> rem/v3 return func(o *Options) { o.MeterOptions = append(o.MeterOptions, opts...) } @@ -96,7 +116,11 @@ func (h *Handler) Metrics(ctx context.Context, req *codecpb.Frame, rsp *codecpb. w := io.Writer(buf) +<<<<<<< HEAD + if md, ok := metadata.FromIncomingContext(ctx); gzipAccepted(md) && ok && !h.opts.DisableCompress { +======= if md, ok := metadata.FromOutgoingContext(ctx); gzipAccepted(md) && ok && !h.Options.DisableCompress { +>>>>>>> rem/v3 omd, _ := metadata.FromOutgoingContext(ctx) omd.Set(contentEncodingHeader, "gzip") gz := gzipPool.Get().(*gzip.Writer) @@ -109,8 +133,13 @@ func (h *Handler) Metrics(ctx context.Context, req *codecpb.Frame, rsp *codecpb. gz.Flush() } +<<<<<<< HEAD + if err := h.opts.Meter.Write(w, h.opts.MeterOptions...); err != nil { + log.Error(ctx, "http/meter: write failed", err) +======= if err := h.Options.Meter.Write(w, h.Options.MeterOptions...); err != nil { log.Error(ctx, "http/meter write failed", err) +>>>>>>> rem/v3 return nil } diff --git a/handler/meter/meter.proto b/handler/meter/meter.proto index ef08f72..165059e 100644 --- a/handler/meter/meter.proto +++ b/handler/meter/meter.proto @@ -1,7 +1,12 @@ syntax = "proto3"; +<<<<<<< HEAD +package micro.server.http.v4.handler.meter; +option go_package = "go.unistack.org/micro-server-http/v4/handler/meter;meter"; +======= package micro.server.http.v3.handler.meter; option go_package = "go.unistack.org/micro-server-http/v3/handler/meter;meter_handler"; +>>>>>>> rem/v3 import "api/annotations.proto"; import "openapiv3/annotations.proto"; diff --git a/handler/meter/meter_micro.pb.go b/handler/meter/meter_micro.pb.go index fb627ef..3d2104a 100644 --- a/handler/meter/meter_micro.pb.go +++ b/handler/meter/meter_micro.pb.go @@ -1,24 +1,36 @@ // Code generated by protoc-gen-go-micro. DO NOT EDIT. // versions: +<<<<<<< HEAD +// - protoc-gen-go-micro v4.0.2 +// - protoc v4.23.4 +======= // - protoc-gen-go-micro v3.10.4 // - protoc v5.28.3 +>>>>>>> rem/v3 // source: meter/meter.proto package meter_handler import ( context "context" +<<<<<<< HEAD + codec "go.unistack.org/micro-proto/v4/codec" +======= codec "go.unistack.org/micro-proto/v3/codec" client "go.unistack.org/micro/v3/client" +>>>>>>> rem/v3 ) var ( MeterServiceName = "MeterService" ) +<<<<<<< HEAD +======= type MeterServiceClient interface { Metrics(ctx context.Context, req *codec.Frame, opts ...client.CallOption) (*codec.Frame, error) } +>>>>>>> rem/v3 type MeterServiceServer interface { Metrics(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error diff --git a/handler/meter/meter_micro_http.pb.go b/handler/meter/meter_micro_http.pb.go index 2eccdf6..9b52354 100644 --- a/handler/meter/meter_micro_http.pb.go +++ b/handler/meter/meter_micro_http.pb.go @@ -1,17 +1,40 @@ // Code generated by protoc-gen-go-micro. DO NOT EDIT. +<<<<<<< HEAD +// protoc-gen-go-micro version: v4.0.2 +======= // protoc-gen-go-micro version: v3.10.4 +>>>>>>> rem/v3 // source: meter/meter.proto package meter_handler import ( context "context" +<<<<<<< HEAD + codec "go.unistack.org/micro-proto/v4/codec" + v4 "go.unistack.org/micro-server-http/v4" + options "go.unistack.org/micro/v4/options" + server "go.unistack.org/micro/v4/server" +) + +var ( + MeterServiceServerEndpoints = []v4.EndpointMetadata{ + { + Name: "MeterService.Metrics", + Path: "/metrics", + Method: "GET", + Body: "", + Stream: false, + }, + } +======= v31 "go.unistack.org/micro-client-http/v3" codec "go.unistack.org/micro-proto/v3/codec" v3 "go.unistack.org/micro-server-http/v3" client "go.unistack.org/micro/v3/client" server "go.unistack.org/micro/v3/server" http "net/http" +>>>>>>> rem/v3 ) var ( @@ -61,7 +84,7 @@ func (h *meterServiceServer) Metrics(ctx context.Context, req *codec.Frame, rsp return h.MeterServiceServer.Metrics(ctx, req, rsp) } -func RegisterMeterServiceServer(s server.Server, sh MeterServiceServer, opts ...server.HandlerOption) error { +func RegisterMeterServiceServer(s server.Server, sh MeterServiceServer, opts ...options.Option) error { type meterService interface { Metrics(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error } @@ -69,7 +92,7 @@ func RegisterMeterServiceServer(s server.Server, sh MeterServiceServer, opts ... meterService } h := &meterServiceServer{sh} - var nopts []server.HandlerOption - nopts = append(nopts, v3.HandlerEndpoints(MeterServiceServerEndpoints)) - return s.Handle(s.NewHandler(&MeterService{h}, append(nopts, opts...)...)) + var nopts []options.Option + nopts = append(nopts, v4.HandlerEndpoints(MeterServiceServerEndpoints)) + return s.Handle(&MeterService{h}, append(nopts, opts...)...) } diff --git a/handler/meter/meter_test.go b/handler/meter/meter_test.go new file mode 100644 index 0000000..a3b7f51 --- /dev/null +++ b/handler/meter/meter_test.go @@ -0,0 +1,49 @@ +package meter + +import ( + "context" + "testing" + + codecpb "go.unistack.org/micro-proto/v4/codec" +) + +func TestHandler_Metrics(t *testing.T) { + type fields struct { + opts Options + } + type args struct { + ctx context.Context + req *codecpb.Frame + rsp *codecpb.Frame + } + tests := []struct { + name string + fields fields + args args + wantErr bool + }{ + { + "Test #1", + fields{ + opts: NewOptions(), + }, + args{ + context.Background(), + &codecpb.Frame{Data: []byte("gzip")}, + &codecpb.Frame{}, + }, + true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + h := &Handler{ + opts: tt.fields.opts, + } + if err := h.Metrics(tt.args.ctx, tt.args.req, tt.args.rsp); (err != nil) != tt.wantErr { + t.Errorf("Metrics() error = %v, wantErr %v", err, tt.wantErr) + } + t.Logf("RSP: %v", tt.args.rsp.Data) + }) + } +} diff --git a/handler/swagger-ui/swaggerui.go b/handler/swagger-ui/swaggerui.go index cd486db..c3e1e9a 100644 --- a/handler/swagger-ui/swaggerui.go +++ b/handler/swagger-ui/swaggerui.go @@ -1,4 +1,8 @@ +<<<<<<< HEAD +package swaggerui // import "go.unistack.org/micro-server-http/v4/handler/swagger-ui" +======= package swaggerui_handler +>>>>>>> rem/v3 import ( "embed" diff --git a/handler/swagger-ui/swaggerui_test.go b/handler/swagger-ui/swaggerui_test.go index 88e068a..1a42f9a 100644 --- a/handler/swagger-ui/swaggerui_test.go +++ b/handler/swagger-ui/swaggerui_test.go @@ -1,4 +1,8 @@ +<<<<<<< HEAD +package swaggerui +======= package swaggerui_handler +>>>>>>> rem/v3 import ( "net/http" diff --git a/handler/swagger/swagger.go b/handler/swagger/swagger.go index 5daf7d1..21c3be7 100644 --- a/handler/swagger/swagger.go +++ b/handler/swagger/swagger.go @@ -1,11 +1,20 @@ +<<<<<<< HEAD +package swagger +======= package swagger_handler +>>>>>>> rem/v3 import ( "io/fs" "net/http" +<<<<<<< HEAD + yamlcodec "go.unistack.org/micro-codec-yaml/v4" + rutil "go.unistack.org/micro/v4/util/reflect" +======= yamlcodec "go.unistack.org/micro-codec-yaml/v3" rutil "go.unistack.org/micro/v3/util/reflect" +>>>>>>> rem/v3 ) // Handler append to generated swagger data from dst map[string]interface{} diff --git a/http.go b/http.go index c228d22..5124dc6 100644 --- a/http.go +++ b/http.go @@ -1,5 +1,5 @@ // Package http implements a go-micro.Server -package http // import "go.unistack.org/micro-server-http/v3" +package http // import "go.unistack.org/micro-server-http/v4" import ( "context" @@ -9,30 +9,32 @@ import ( "net" "net/http" "reflect" - "sort" "strings" "sync" "sync/atomic" "time" - "go.unistack.org/micro/v3/broker" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/register" - "go.unistack.org/micro/v3/server" - rhttp "go.unistack.org/micro/v3/util/http" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/options" + "go.unistack.org/micro/v4/register" + "go.unistack.org/micro/v4/server" + rhttp "go.unistack.org/micro/v4/util/http" "golang.org/x/net/netutil" ) var _ server.Server = (*Server)(nil) type Server struct { +<<<<<<< HEAD + hd interface{} +======= hd server.Handler +>>>>>>> rem/v3 rsvc *register.Service - handlers map[string]server.Handler + handlers map[string]interface{} exit chan chan error - subscribers map[*httpSubscriber][]broker.Subscriber - errorHandler func(context.Context, server.Handler, http.ResponseWriter, *http.Request, error, int) + errorHandler func(context.Context, interface{}, http.ResponseWriter, *http.Request, error, int) pathHandlers *rhttp.Trie opts server.Options stateLive *atomic.Uint32 @@ -64,7 +66,11 @@ func (h *Server) Options() server.Options { return opts } +<<<<<<< HEAD +func (h *Server) Init(opts ...options.Option) error { +======= func (h *Server) Init(opts ...server.Option) error { +>>>>>>> rem/v3 if len(opts) == 0 && h.init { return nil } @@ -74,11 +80,11 @@ func (h *Server) Init(opts ...server.Option) error { for _, o := range opts { o(&h.opts) } - if fn, ok := h.opts.Context.Value(errorHandlerKey{}).(func(ctx context.Context, s server.Handler, w http.ResponseWriter, r *http.Request, err error, status int)); ok && fn != nil { + if fn, ok := h.opts.Context.Value(errorHandlerKey{}).(func(ctx context.Context, s interface{}, w http.ResponseWriter, r *http.Request, err error, status int)); ok && fn != nil { h.errorHandler = fn } if h.handlers == nil { - h.handlers = make(map[string]server.Handler) + h.handlers = make(map[string]interface{}) } if h.pathHandlers == nil { h.pathHandlers = rhttp.NewTrie() @@ -105,10 +111,6 @@ func (h *Server) Init(opts ...server.Option) error { h.RUnlock() return err } - if err := h.opts.Broker.Init(); err != nil { - h.RUnlock() - return err - } if err := h.opts.Tracer.Init(); err != nil { h.RUnlock() return err @@ -121,7 +123,10 @@ func (h *Server) Init(opts ...server.Option) error { h.RUnlock() return err } +<<<<<<< HEAD +======= +>>>>>>> rem/v3 h.RUnlock() h.Lock() @@ -131,12 +136,28 @@ func (h *Server) Init(opts ...server.Option) error { return nil } +<<<<<<< HEAD +func (h *Server) Handle(handler interface{}, opts ...options.Option) error { + options := server.NewHandleOptions(opts...) + var endpointMetadata []EndpointMetadata + + if v, ok := options.Context.Value(handlerEndpointsKey{}).([]EndpointMetadata); ok { + endpointMetadata = v + } + +======= func (h *Server) Handle(handler server.Handler) error { +>>>>>>> rem/v3 // passed unknown handler hdlr, ok := handler.(*httpHandler) if !ok { h.Lock() - h.hd = handler + if h.handlers == nil { + h.handlers = make(map[string]interface{}) + } + for _, v := range endpointMetadata { + h.handlers[v.Name] = h.newHTTPHandler(handler, opts...) + } h.Unlock() return nil } @@ -149,19 +170,16 @@ func (h *Server) Handle(handler server.Handler) error { return nil } - // passed micro compat handler - h.Lock() - if h.handlers == nil { - h.handlers = make(map[string]server.Handler) - } - h.handlers[handler.Name()] = handler - h.Unlock() - return nil } +<<<<<<< HEAD +func (h *Server) newHTTPHandler(handler interface{}, opts ...options.Option) *httpHandler { + options := server.NewHandleOptions(opts...) +======= func (h *Server) NewHandler(handler interface{}, opts ...server.HandlerOption) server.Handler { options := server.NewHandlerOptions(opts...) +>>>>>>> rem/v3 eps := make([]*register.Endpoint, 0, len(options.Metadata)) for name, metadata := range options.Metadata { @@ -216,7 +234,11 @@ func (h *Server) NewHandler(handler interface{}, opts ...server.HandlerOption) s mtype, err := prepareEndpoint(method) if err != nil && h.opts.Logger.V(logger.ErrorLevel) { +<<<<<<< HEAD + h.opts.Logger.Error(h.opts.Context, fmt.Sprintf("%v", err)) +======= h.opts.Logger.Error(h.opts.Context, "endpoint error", err) +>>>>>>> rem/v3 continue } else if mtype == nil { h.opts.Logger.Error(h.opts.Context, fmt.Sprintf("nil mtype for %s", mname)) @@ -229,6 +251,15 @@ func (h *Server) NewHandler(handler interface{}, opts ...server.HandlerOption) s pth := &patHandler{mtype: mtype, name: name, rcvr: rcvr} hdlr.name = name +<<<<<<< HEAD + if err := hdlr.handlers.Insert([]string{md["Method"]}, md["Path"], pth); err != nil { + h.opts.Logger.Error(h.opts.Context, fmt.Sprintf("cant add handler for %s %s", md["Method"][0], md["Path"][0])) + } + + if h.registerRPC { + h.opts.Logger.Info(h.opts.Context, fmt.Sprintf("register rpc handler for http.MethodPost %s /%s", hn, hn)) + if err := hdlr.handlers.Insert([]string{http.MethodPost}, "/"+hn, pth); err != nil { +======= methods := []string{md["Method"]} if registerCORS { methods = append(methods, http.MethodOptions) @@ -245,6 +276,7 @@ func (h *Server) NewHandler(handler interface{}, opts ...server.HandlerOption) s } if err := hdlr.handlers.Insert(methods, "/"+hn, pth); err != nil { +>>>>>>> rem/v3 h.opts.Logger.Error(h.opts.Context, fmt.Sprintf("cant add rpc handler for http.MethodPost %s /%s", hn, hn)) } } @@ -275,7 +307,11 @@ func (h *Server) NewHandler(handler interface{}, opts ...server.HandlerOption) s mtype, err := prepareEndpoint(method) if err != nil && h.opts.Logger.V(logger.ErrorLevel) { +<<<<<<< HEAD + h.opts.Logger.Error(h.opts.Context, fmt.Sprintf("%v", err)) +======= h.opts.Logger.Error(h.opts.Context, "prepare endpoint error", err) +>>>>>>> rem/v3 continue } else if mtype == nil { h.opts.Logger.Error(h.opts.Context, fmt.Sprintf("nil mtype for %s", mname)) @@ -288,16 +324,24 @@ func (h *Server) NewHandler(handler interface{}, opts ...server.HandlerOption) s pth := &patHandler{mtype: mtype, name: name, rcvr: rcvr} hdlr.name = name +<<<<<<< HEAD + if err := hdlr.handlers.Insert([]string{md.Method}, md.Path, pth); err != nil { +======= methods := []string{md.Method} if registerCORS { methods = append(methods, http.MethodOptions) } if err := hdlr.handlers.Insert(methods, md.Path, pth); err != nil { +>>>>>>> rem/v3 h.opts.Logger.Error(h.opts.Context, fmt.Sprintf("cant add handler for %s %s", md.Method, md.Path)) } if h.registerRPC { +<<<<<<< HEAD + h.opts.Logger.Info(h.opts.Context, fmt.Sprintf("register rpc handler for http.MethodPost %s /%s", hn, hn)) + if err := hdlr.handlers.Insert([]string{http.MethodPost}, "/"+hn, pth); err != nil { +======= methods := []string{http.MethodPost} if registerCORS { methods = append(methods, http.MethodOptions) @@ -305,6 +349,7 @@ func (h *Server) NewHandler(handler interface{}, opts ...server.HandlerOption) s h.opts.Logger.Info(h.opts.Context, fmt.Sprintf("register rpc handler for http.MethodPost %s /%s", hn, hn)) if err := hdlr.handlers.Insert(methods, "/"+hn, pth); err != nil { +>>>>>>> rem/v3 h.opts.Logger.Error(h.opts.Context, fmt.Sprintf("cant add rpc handler for http.MethodPost %s /%s", hn, hn)) } } @@ -313,6 +358,8 @@ func (h *Server) NewHandler(handler interface{}, opts ...server.HandlerOption) s return hdlr } +<<<<<<< HEAD +======= func (h *Server) NewSubscriber(topic string, handler interface{}, opts ...server.SubscriberOption) server.Subscriber { return newSubscriber(topic, handler, opts...) } @@ -342,11 +389,16 @@ func (h *Server) Subscribe(sb server.Subscriber) error { return nil } +>>>>>>> rem/v3 func (h *Server) Register() error { var eps []*register.Endpoint h.RLock() for _, hdlr := range h.handlers { - eps = append(eps, hdlr.Endpoints()...) + hd, ok := hdlr.(*httpHandler) + if !ok { + continue + } + eps = append(eps, hd.Endpoints()...) } rsvc := h.rsvc config := h.opts @@ -364,24 +416,9 @@ func (h *Server) Register() error { if err != nil { return err } - service.Nodes[0].Metadata["protocol"] = "http" + service.Nodes[0].Metadata.Set("protocol", "http") service.Endpoints = eps - h.Lock() - subscriberList := make([]*httpSubscriber, 0, len(h.subscribers)) - for e := range h.subscribers { - // Only advertise non internal subscribers - subscriberList = append(subscriberList, e) - } - sort.Slice(subscriberList, func(i, j int) bool { - return subscriberList[i].topic > subscriberList[j].topic - }) - - for _, e := range subscriberList { - service.Endpoints = append(service.Endpoints, e.Endpoints()...) - } - h.Unlock() - h.RLock() registered := h.registered h.RUnlock() @@ -403,11 +440,16 @@ func (h *Server) Register() error { } h.Lock() +<<<<<<< HEAD +======= +>>>>>>> rem/v3 h.registered = true h.rsvc = service h.Unlock() +<<<<<<< HEAD +======= return nil } @@ -437,6 +479,7 @@ func (h *Server) subscribe() error { h.subscribers[sb] = []broker.Subscriber{sub} } +>>>>>>> rem/v3 return nil } @@ -451,7 +494,11 @@ func (h *Server) Deregister() error { } if config.Logger.V(logger.InfoLevel) { +<<<<<<< HEAD + config.Logger.Info(config.Context, fmt.Sprintf("Deregistering node: %s", service.Nodes[0].ID)) +======= config.Logger.Info(config.Context, "Deregistering node: "+service.Nodes[0].ID) +>>>>>>> rem/v3 } if err := server.DefaultDeregisterFunc(service, config); err != nil { @@ -467,6 +514,8 @@ func (h *Server) Deregister() error { } h.registered = false +<<<<<<< HEAD +======= subCtx := h.opts.Context for sb, subs := range h.subscribers { @@ -484,6 +533,7 @@ func (h *Server) Deregister() error { } h.subscribers[sb] = nil } +>>>>>>> rem/v3 h.Unlock() return nil } @@ -518,7 +568,11 @@ func (h *Server) Start() error { } if config.Logger.V(logger.InfoLevel) { +<<<<<<< HEAD + config.Logger.Info(config.Context, fmt.Sprintf("Listening on %s", ts.Addr().String())) +======= config.Logger.Info(config.Context, "Listening on "+ts.Addr().String()) +>>>>>>> rem/v3 } h.Lock() @@ -531,7 +585,7 @@ func (h *Server) Start() error { if h.opts.Context != nil { if hs, ok := h.opts.Context.Value(serverKey{}).(*http.Server); ok && hs != nil { if hs.Handler == nil && h.hd != nil { - if hdlr, ok := h.hd.Handler().(http.Handler); ok { + if hdlr, ok := h.hd.(http.Handler); ok { hs.Handler = hdlr handler = hs.Handler } @@ -547,7 +601,7 @@ func (h *Server) Start() error { case len(h.handlers) > 0 && h.hd != nil: handler = h case handler == nil && h.hd != nil: - if hdlr, ok := h.hd.Handler().(http.Handler); ok { + if hdlr, ok := h.hd.(http.Handler); ok { handler = hdlr } } @@ -556,13 +610,13 @@ func (h *Server) Start() error { return fmt.Errorf("cant process with nil handler") } - if err := config.Broker.Connect(h.opts.Context); err != nil { - return err - } - if err := config.RegisterCheck(h.opts.Context); err != nil { if config.Logger.V(logger.ErrorLevel) { +<<<<<<< HEAD + config.Logger.Error(config.Context, fmt.Sprintf("Server %s-%s register check error: %s", config.Name, config.ID, err)) +======= config.Logger.Error(config.Context, fmt.Sprintf("Server %s-%s register check error", config.Name, config.ID), err) +>>>>>>> rem/v3 } } else { if err = h.Register(); err != nil { @@ -593,12 +647,18 @@ func (h *Server) Start() error { } go func() { +<<<<<<< HEAD + if cerr := hs.Serve(ts); cerr != nil && !errors.Is(cerr, net.ErrClosed) { + h.opts.Logger.Error(h.opts.Context, cerr.Error()) + } +======= if cerr := hs.Serve(ts); cerr != nil && !errors.Is(cerr, http.ErrServerClosed) { h.opts.Logger.Error(h.opts.Context, "serve error", cerr) } h.stateLive.Store(0) h.stateReady.Store(0) h.stateHealth.Store(0) +>>>>>>> rem/v3 }() go func() { @@ -625,28 +685,48 @@ func (h *Server) Start() error { // nolint: nestif if rerr != nil && registered { if config.Logger.V(logger.ErrorLevel) { +<<<<<<< HEAD + config.Logger.Error(config.Context, fmt.Sprintf("Server %s-%s register check error: %s, deregister it", config.Name, config.ID, rerr)) +======= config.Logger.Error(config.Context, fmt.Sprintf("Server %s-%s register check error, deregister it", config.Name, config.ID), rerr) +>>>>>>> rem/v3 } // deregister self in case of error if err := h.Deregister(); err != nil { if config.Logger.V(logger.ErrorLevel) { +<<<<<<< HEAD + config.Logger.Error(config.Context, fmt.Sprintf("Server %s-%s deregister error: %s", config.Name, config.ID, err)) +======= config.Logger.Error(config.Context, fmt.Sprintf("Server %s-%s deregister error", config.Name, config.ID), err) +>>>>>>> rem/v3 } } } else if rerr != nil && !registered { if config.Logger.V(logger.ErrorLevel) { +<<<<<<< HEAD + config.Logger.Error(config.Context, fmt.Sprintf("Server %s-%s register check error: %s", config.Name, config.ID, rerr)) +======= config.Logger.Error(config.Context, fmt.Sprintf("Server %s-%s register check error", config.Name, config.ID), rerr) +>>>>>>> rem/v3 } continue } if err := h.Register(); err != nil { if config.Logger.V(logger.ErrorLevel) { +<<<<<<< HEAD + config.Logger.Error(config.Context, fmt.Sprintf("Server %s-%s register error: %s", config.Name, config.ID, err)) +======= config.Logger.Error(config.Context, fmt.Sprintf("Server %s-%s register error", config.Name, config.ID), err) +>>>>>>> rem/v3 } } if err := h.Register(); err != nil { +<<<<<<< HEAD + config.Logger.Error(config.Context, fmt.Sprintf("Server register error: %s", err)) +======= config.Logger.Error(config.Context, "Server register error", err) +>>>>>>> rem/v3 } // wait for exit case ch = <-h.exit: @@ -656,6 +736,19 @@ func (h *Server) Start() error { // deregister if err := h.Deregister(); err != nil { +<<<<<<< HEAD + config.Logger.Error(config.Context, fmt.Sprintf("Server deregister error: %s", err)) + } + + ctx, cancel := context.WithTimeout(context.Background(), h.opts.GracefulTimeout) + defer cancel() + + err := hs.Shutdown(ctx) + if err != nil { + err = hs.Close() + } + +======= config.Logger.Error(config.Context, "Server deregister error", err) } @@ -671,6 +764,7 @@ func (h *Server) Start() error { err = hs.Close() } +>>>>>>> rem/v3 ch <- err }() @@ -695,6 +789,9 @@ func (h *Server) Name() string { return h.opts.Name } +<<<<<<< HEAD +func NewServer(opts ...options.Option) *Server { +======= func (h *Server) Live() bool { return h.stateLive.Load() == 1 } @@ -708,18 +805,21 @@ func (h *Server) Health() bool { } func NewServer(opts ...server.Option) *Server { +>>>>>>> rem/v3 options := server.NewOptions(opts...) eh := DefaultErrorHandler if v, ok := options.Context.Value(errorHandlerKey{}).(errorHandler); ok && v != nil { eh = v } return &Server{ +<<<<<<< HEAD +======= stateLive: &atomic.Uint32{}, stateReady: &atomic.Uint32{}, stateHealth: &atomic.Uint32{}, +>>>>>>> rem/v3 opts: options, exit: make(chan chan error), - subscribers: make(map[*httpSubscriber][]broker.Subscriber), errorHandler: eh, pathHandlers: rhttp.NewTrie(), } diff --git a/message.go b/message.go index 226d6b1..394c788 100644 --- a/message.go +++ b/message.go @@ -1,8 +1,8 @@ package http import ( - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/metadata" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/metadata" ) type httpMessage struct { diff --git a/options.go b/options.go index 98908df..9b955cb 100644 --- a/options.go +++ b/options.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "go.unistack.org/micro/v3/server" + "go.unistack.org/micro/v4/options" ) // SetError pass error to caller @@ -79,24 +79,29 @@ func GetRspCode(ctx context.Context) int { type middlewareKey struct{} // Middleware passes http middlewares -func Middleware(mw ...func(http.Handler) http.Handler) server.Option { - return server.SetOption(middlewareKey{}, mw) +func Middleware(mw ...func(http.Handler) http.Handler) options.Option { + return options.ContextOption(middlewareKey{}, mw) } type serverKey struct{} // HTTPServer provide ability to pass *http.Server +<<<<<<< HEAD +func HTTPServer(hs *http.Server) options.Option { + return options.ContextOption(serverKey{}, hs) +======= func HTTPServer(hs *http.Server) server.Option { return server.SetOption(serverKey{}, hs) +>>>>>>> rem/v3 } -type errorHandler func(ctx context.Context, s server.Handler, w http.ResponseWriter, r *http.Request, err error, status int) +type errorHandler func(ctx context.Context, s interface{}, w http.ResponseWriter, r *http.Request, err error, status int) type errorHandlerKey struct{} // ErrorHandler specifies handler for errors -func ErrorHandler(fn errorHandler) server.Option { - return server.SetOption(errorHandlerKey{}, fn) +func ErrorHandler(fn errorHandler) options.Option { + return options.ContextOption(errorHandlerKey{}, fn) } type ( @@ -107,12 +112,18 @@ type ( ) // PathHandler specifies http handler for path regexp -func PathHandler(method, path string, handler http.HandlerFunc) server.Option { - return func(o *server.Options) { - if o.Context == nil { - o.Context = context.Background() +func PathHandler(method, path string, handler http.HandlerFunc) options.Option { + return func(src interface{}) error { + vctx, err := options.Get(src, ".Context") + if err != nil { + return err } - v, ok := o.Context.Value(pathHandlerKey{}).(*pathHandlerVal) + ctx, ok := vctx.(context.Context) + if !ok { + return fmt.Errorf("invalid option") + } + + v, ok := ctx.Value(pathHandlerKey{}).(*pathHandlerVal) if !ok { v = &pathHandlerVal{h: make(map[string]map[string]http.HandlerFunc)} } @@ -121,16 +132,17 @@ func PathHandler(method, path string, handler http.HandlerFunc) server.Option { m = make(map[string]http.HandlerFunc) v.h[method] = m } + ctx = context.WithValue(ctx, pathHandlerKey{}, v) m[path] = handler - o.Context = context.WithValue(o.Context, pathHandlerKey{}, v) + return options.Set(src, ctx, ".Context") } } type registerRPCHandlerKey struct{} // RegisterRPCHandler registers compatibility endpoints with /ServiceName.ServiceEndpoint method POST -func RegisterRPCHandler(b bool) server.Option { - return server.SetOption(registerRPCHandlerKey{}, b) +func RegisterRPCHandler(b bool) options.Option { + return options.ContextOption(registerRPCHandlerKey{}, b) } type registerCORSHandlerKey struct{} @@ -150,8 +162,8 @@ type EndpointMetadata struct { Stream bool } -func HandlerEndpoints(md []EndpointMetadata) server.HandlerOption { - return server.SetHandlerOption(handlerEndpointsKey{}, md) +func HandlerEndpoints(md []EndpointMetadata) options.Option { + return options.ContextOption(handlerEndpointsKey{}, md) } type handlerOptions struct { diff --git a/request.go b/request.go index 1b301b2..cbf1737 100644 --- a/request.go +++ b/request.go @@ -3,15 +3,12 @@ package http import ( "io" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/metadata" - "go.unistack.org/micro/v3/server" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/server" ) -var ( - _ server.Request = &rpcRequest{} - _ server.Message = &rpcMessage{} -) +var _ server.Request = &rpcRequest{} type rpcRequest struct { rw io.ReadWriter @@ -25,14 +22,6 @@ type rpcRequest struct { stream bool } -type rpcMessage struct { - payload interface{} - codec codec.Codec - header metadata.Metadata - topic string - contentType string -} - func (r *rpcRequest) ContentType() string { return r.contentType } @@ -68,23 +57,3 @@ func (r *rpcRequest) Stream() bool { func (r *rpcRequest) Body() interface{} { return r.payload } - -func (r *rpcMessage) ContentType() string { - return r.contentType -} - -func (r *rpcMessage) Topic() string { - return r.topic -} - -func (r *rpcMessage) Body() interface{} { - return r.payload -} - -func (r *rpcMessage) Header() metadata.Metadata { - return r.header -} - -func (r *rpcMessage) Codec() codec.Codec { - return r.codec -} diff --git a/server.go b/server.go index 7508467..8669be3 100644 --- a/server.go +++ b/server.go @@ -7,9 +7,11 @@ import ( "unicode" "unicode/utf8" - "go.unistack.org/micro/v3/server" + "go.unistack.org/micro/v4/server" ) +var typeOfError = reflect.TypeOf((*error)(nil)).Elem() + type methodType struct { ArgType reflect.Type ReplyType reflect.Type diff --git a/tools.go b/tools.go new file mode 100644 index 0000000..80ebc7c --- /dev/null +++ b/tools.go @@ -0,0 +1,8 @@ +//go:build tools + +package http + +import ( + _ "go.unistack.org/micro-proto/v4" + _ "go.unistack.org/protoc-gen-go-micro/v4" +) diff --git a/util.go b/util.go index 99576d3..d07d3ad 100644 --- a/util.go +++ b/util.go @@ -5,8 +5,8 @@ import ( "net/http" "strings" - "go.unistack.org/micro/v3/metadata" - rutil "go.unistack.org/micro/v3/util/reflect" + "go.unistack.org/micro/v4/metadata" + rutil "go.unistack.org/micro/v4/util/reflect" ) func FillRequest(ctx context.Context, req interface{}, opts ...FillRequestOption) error { @@ -31,15 +31,13 @@ func FillRequest(ctx context.Context, req interface{}, opts ...FillRequestOption } } - cookies := strings.Split(md["Cookie"], ";") + cookies := md["Cookie"] cmd := make(map[string]string, len(cookies)) - for _, cookie := range cookies { - kv := strings.Split(cookie, "=") - if len(kv) != 2 { - continue - } - cmd[strings.TrimSpace(kv[0])] = strings.TrimSpace(kv[1]) + kv := strings.Split(cookies, "=") + if len(kv) != 2 { + return nil } + cmd[strings.TrimSpace(kv[0])] = strings.TrimSpace(kv[1]) for idx := 0; idx < len(options.cookies)/2; idx += 2 { k := http.CanonicalHeaderKey(options.cookies[idx]) v, ok := cmd[k] diff --git a/util_test.go b/util_test.go index f19e867..2e96025 100644 --- a/util_test.go +++ b/util_test.go @@ -7,9 +7,13 @@ import ( "strings" "testing" +<<<<<<< HEAD + "go.unistack.org/micro/v4/metadata" +======= "go.unistack.org/micro/v3/metadata" "go.unistack.org/micro/v3/options" "go.unistack.org/micro/v3/server" +>>>>>>> rem/v3 ) func Test_Hook(t *testing.T) {