From a7ffba9de1e16b7e00129bf957e00c28babce7e7 Mon Sep 17 00:00:00 2001 From: Mostafa Date: Tue, 18 Jun 2024 21:04:50 +0800 Subject: [PATCH 1/6] update github action --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d4d7d2a..4c2f18b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,7 +10,7 @@ jobs: test: strategy: matrix: - go: [ '1.17.2' ] + go: [ '1.21' ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From afd96a453e3a58efe7fbf85e9acf9ae63f2e68d9 Mon Sep 17 00:00:00 2001 From: Mostafa Date: Tue, 18 Jun 2024 21:07:25 +0800 Subject: [PATCH 2/6] rename action files --- .github/workflows/{ci.yaml => ci.yml} | 0 .github/workflows/{release.yaml => release.yml} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{ci.yaml => ci.yml} (100%) rename .github/workflows/{release.yaml => release.yml} (100%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yml similarity index 100% rename from .github/workflows/ci.yaml rename to .github/workflows/ci.yml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yml similarity index 100% rename from .github/workflows/release.yaml rename to .github/workflows/release.yml From 4da705e086b2d4673232d08383f0a6c6a5e57f47 Mon Sep 17 00:00:00 2001 From: Mostafa Date: Tue, 18 Jun 2024 21:08:39 +0800 Subject: [PATCH 3/6] update github action --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c2f18b..6ebb94a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,9 +18,6 @@ jobs: with: go-version: ${{ matrix.go }} - - name: Dependencies - run: go get google.golang.org/protobuf/{proto,protoc-gen-go} github.com/haya14busa/goverage - - name: Tests run: | goverage -race -coverprofile=coverage.txt -covermode=atomic From f3966384efd1421ece8531bbeaced50b1e5177ac Mon Sep 17 00:00:00 2001 From: Mostafa Date: Tue, 18 Jun 2024 21:47:37 +0800 Subject: [PATCH 4/6] fixing tests --- .github/workflows/ci.yml | 9 ++++++--- go.mod | 8 ++------ go.sum | 25 +++++-------------------- template_test.go | 24 +++++++++++++----------- 4 files changed, 26 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ebb94a..89f8cd3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,10 +18,13 @@ jobs: with: go-version: ${{ matrix.go }} + - name: Dependencies + run: go install github.com/haya14busa/goverage + - name: Tests run: | goverage -race -coverprofile=coverage.txt -covermode=atomic - make test/bench test/lint + make test/units test/bench test/lint - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 + # - name: Upload coverage to Codecov + # uses: codecov/codecov-action@v2 diff --git a/go.mod b/go.mod index dcce2a3..ace9fc8 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.21 require ( github.com/Masterminds/sprig v2.22.0+incompatible github.com/envoyproxy/protoc-gen-validate v1.0.4 + github.com/gogo/protobuf v1.3.2 github.com/mwitkow/go-proto-validators v0.3.2 github.com/pseudomuto/protokit v0.2.1 github.com/stretchr/testify v1.8.4 @@ -16,18 +17,13 @@ require ( github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/google/go-cmp v0.6.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/huandu/xstrings v1.5.0 // indirect github.com/imdario/mergo v0.3.16 // indirect - github.com/kr/pretty v0.3.0 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/rogpeppe/go-internal v1.9.0 // indirect - golang.org/x/crypto v0.24.0 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect + golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 98cd572..aedbaff 100644 --- a/go.sum +++ b/go.sum @@ -4,7 +4,6 @@ github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3Q github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= -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= @@ -16,8 +15,8 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69 github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= @@ -27,14 +26,6 @@ github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+h github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -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= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= @@ -45,9 +36,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pseudomuto/protokit v0.2.1 h1:kCYpE3thoR6Esm0CUvd5xbrDTOZPvQPTDeyXpZfrJdk= github.com/pseudomuto/protokit v0.2.1/go.mod h1:gt7N5Rz2flBzYafvaxyIxMZC0TTF5jDZfRnw25hAAyo= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= @@ -56,9 +44,8 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -81,15 +68,13 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f 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= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 h1:MuYw1wJzT+ZkybKfaOXKp5hJiZDn2iHaXRw0mRYdHSc= google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4/go.mod h1:px9SlOOZBg1wM1zdnr8jEL4CNGUBZ+ZKYtNPApNQc4c= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -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.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/template_test.go b/template_test.go index cca84b9..f69aab1 100644 --- a/template_test.go +++ b/template_test.go @@ -4,12 +4,14 @@ import ( "os" "testing" + "github.com/gogo/protobuf/proto" . "github.com/pactus-project/protoc-gen-doc" "github.com/pactus-project/protoc-gen-doc/extensions" "github.com/pseudomuto/protokit" "github.com/pseudomuto/protokit/utils" "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/runtime/protoimpl" descriptor "google.golang.org/protobuf/types/descriptorpb" ) @@ -44,7 +46,7 @@ func TestMain(m *testing.M) { func identity(payload interface{}) interface{} { return payload } -var E_ExtendFile = &proto.ExtensionDesc{ +var E_ExtendFile = &protoimpl.ExtensionInfo{ ExtendedType: (*descriptor.FileOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, @@ -53,7 +55,7 @@ var E_ExtendFile = &proto.ExtensionDesc{ Filename: "extend.proto", } -var E_ExtendService = &proto.ExtensionDesc{ +var E_ExtendService = &protoimpl.ExtensionInfo{ ExtendedType: (*descriptor.ServiceOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, @@ -62,7 +64,7 @@ var E_ExtendService = &proto.ExtensionDesc{ Filename: "extend.proto", } -var E_ExtendMethod = &proto.ExtensionDesc{ +var E_ExtendMethod = &protoimpl.ExtensionInfo{ ExtendedType: (*descriptor.MethodOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, @@ -71,7 +73,7 @@ var E_ExtendMethod = &proto.ExtensionDesc{ Filename: "extend.proto", } -var E_ExtendEnum = &proto.ExtensionDesc{ +var E_ExtendEnum = &protoimpl.ExtensionInfo{ ExtendedType: (*descriptor.EnumOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, @@ -80,7 +82,7 @@ var E_ExtendEnum = &proto.ExtensionDesc{ Filename: "extend.proto", } -var E_ExtendEnumValue = &proto.ExtensionDesc{ +var E_ExtendEnumValue = &protoimpl.ExtensionInfo{ ExtendedType: (*descriptor.EnumValueOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, @@ -108,15 +110,15 @@ var E_ExtendField = &proto.ExtensionDesc{ } func registerTestExtensions() { - proto.RegisterExtension(E_ExtendFile) + protoregistry.GlobalTypes.RegisterExtension(E_ExtendFile) extensions.SetTransformer(E_ExtendFile.Name, identity) - proto.RegisterExtension(E_ExtendService) + protoregistry.GlobalTypes.RegisterExtension(E_ExtendService) extensions.SetTransformer(E_ExtendService.Name, identity) - proto.RegisterExtension(E_ExtendMethod) + protoregistry.GlobalTypes.RegisterExtension(E_ExtendMethod) extensions.SetTransformer(E_ExtendMethod.Name, identity) - proto.RegisterExtension(E_ExtendEnum) + protoregistry.GlobalTypes.RegisterExtension(E_ExtendEnum) extensions.SetTransformer(E_ExtendEnum.Name, identity) - proto.RegisterExtension(E_ExtendEnumValue) + protoregistry.GlobalTypes.RegisterExtension(E_ExtendEnumValue) extensions.SetTransformer(E_ExtendEnumValue.Name, identity) proto.RegisterExtension(E_ExtendMessage) extensions.SetTransformer(E_ExtendMessage.Name, identity) From 46ea907fd759ad202c08ba9606f628ca7a968535 Mon Sep 17 00:00:00 2001 From: Mostafa Date: Tue, 18 Jun 2024 21:59:20 +0800 Subject: [PATCH 5/6] fixing tests --- examples/doc/example.html | 29 ------------------- examples/doc/example.json | 14 +-------- .../envoyproxy_validate_test.go | 2 +- .../validator_field/validator_field_test.go | 2 +- go.mod | 8 ++--- go.sum | 8 ++--- plugin.go | 4 +-- plugin_test.go | 4 +-- template.go | 2 +- template_test.go | 26 ++++++++--------- 10 files changed, 28 insertions(+), 71 deletions(-) diff --git a/examples/doc/example.html b/examples/doc/example.html index 3b1e017..8402f7b 100644 --- a/examples/doc/example.html +++ b/examples/doc/example.html @@ -378,35 +378,6 @@

BookingStatus

- - -

Validated Fields

- - - - - - - - - - - - - - - -
FieldValidations
description -
    - -
  • string_not_empty: true
  • - -
  • length_lt: 255
  • - -
-
- - diff --git a/examples/doc/example.json b/examples/doc/example.json index d7a75f5..4d1163a 100644 --- a/examples/doc/example.json +++ b/examples/doc/example.json @@ -130,19 +130,7 @@ "ismap": false, "isoneof": false, "oneofdecl": "", - "defaultValue": "", - "options": { - "validator.field": [ - { - "name": "string_not_empty", - "value": true - }, - { - "name": "length_lt", - "value": 255 - } - ] - } + "defaultValue": "" } ] }, diff --git a/extensions/envoyproxy_validate/envoyproxy_validate_test.go b/extensions/envoyproxy_validate/envoyproxy_validate_test.go index def2f59..0d91a0d 100644 --- a/extensions/envoyproxy_validate/envoyproxy_validate_test.go +++ b/extensions/envoyproxy_validate/envoyproxy_validate_test.go @@ -7,7 +7,7 @@ import ( "github.com/pactus-project/protoc-gen-doc/extensions" . "github.com/pactus-project/protoc-gen-doc/extensions/lyft_validate" "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" + "github.com/golang/protobuf/proto" ) func TestTransform(t *testing.T) { diff --git a/extensions/validator_field/validator_field_test.go b/extensions/validator_field/validator_field_test.go index 8dd16d0..6cd53d4 100644 --- a/extensions/validator_field/validator_field_test.go +++ b/extensions/validator_field/validator_field_test.go @@ -7,7 +7,7 @@ import ( "github.com/pactus-project/protoc-gen-doc/extensions" . "github.com/pactus-project/protoc-gen-doc/extensions/validator_field" "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" + "github.com/golang/protobuf/proto" ) func TestTransform(t *testing.T) { diff --git a/go.mod b/go.mod index ace9fc8..69786ca 100644 --- a/go.mod +++ b/go.mod @@ -5,19 +5,19 @@ go 1.21 require ( github.com/Masterminds/sprig v2.22.0+incompatible github.com/envoyproxy/protoc-gen-validate v1.0.4 - github.com/gogo/protobuf v1.3.2 + github.com/golang/protobuf v1.5.4 github.com/mwitkow/go-proto-validators v0.3.2 github.com/pseudomuto/protokit v0.2.1 github.com/stretchr/testify v1.8.4 - google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 - google.golang.org/protobuf v1.34.2 + google.golang.org/genproto v0.0.0-20180427144745-86e600f69ee4 + google.golang.org/protobuf v1.33.0 ) require ( github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/golang/protobuf v1.5.4 // indirect + github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect github.com/huandu/xstrings v1.5.0 // indirect github.com/imdario/mergo v0.3.16 // indirect diff --git a/go.sum b/go.sum index aedbaff..d9d5238 100644 --- a/go.sum +++ b/go.sum @@ -70,10 +70,10 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 h1:MuYw1wJzT+ZkybKfaOXKp5hJiZDn2iHaXRw0mRYdHSc= -google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4/go.mod h1:px9SlOOZBg1wM1zdnr8jEL4CNGUBZ+ZKYtNPApNQc4c= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/genproto v0.0.0-20180427144745-86e600f69ee4 h1:0rk3/gV3HbvCeUzVMhdxV3TEVKMVPDnayjN7sYRmcxY= +google.golang.org/genproto v0.0.0-20180427144745-86e600f69ee4/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +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 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/plugin.go b/plugin.go index 88ebf72..27926fc 100644 --- a/plugin.go +++ b/plugin.go @@ -9,8 +9,8 @@ import ( "strings" "github.com/pseudomuto/protokit" - "google.golang.org/protobuf/proto" - plugin_go "google.golang.org/protobuf/types/pluginpb" + "github.com/golang/protobuf/proto" + plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin" ) // PluginOptions encapsulates options for the plugin. The type of renderer, template file, and the name of the output diff --git a/plugin_test.go b/plugin_test.go index b01db4f..39476fc 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -4,11 +4,11 @@ import ( "regexp" "testing" + "github.com/golang/protobuf/proto" + plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin" . "github.com/pactus-project/protoc-gen-doc" "github.com/pseudomuto/protokit/utils" "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" - plugin_go "google.golang.org/protobuf/types/pluginpb" ) func TestParseOptionsForBuiltinTemplates(t *testing.T) { diff --git a/template.go b/template.go index 7a1d4c4..268a242 100644 --- a/template.go +++ b/template.go @@ -8,7 +8,7 @@ import ( "github.com/pactus-project/protoc-gen-doc/extensions" "github.com/pseudomuto/protokit" - descriptor "google.golang.org/protobuf/types/descriptorpb" + "github.com/golang/protobuf/protoc-gen-go/descriptor" ) // Template is a type for encapsulating all the parsed files, messages, fields, enums, services, extensions, etc. into diff --git a/template_test.go b/template_test.go index f69aab1..4f6825e 100644 --- a/template_test.go +++ b/template_test.go @@ -4,15 +4,13 @@ import ( "os" "testing" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/protoc-gen-go/descriptor" . "github.com/pactus-project/protoc-gen-doc" "github.com/pactus-project/protoc-gen-doc/extensions" "github.com/pseudomuto/protokit" "github.com/pseudomuto/protokit/utils" "github.com/stretchr/testify/require" - "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoimpl" - descriptor "google.golang.org/protobuf/types/descriptorpb" ) var ( @@ -46,7 +44,7 @@ func TestMain(m *testing.M) { func identity(payload interface{}) interface{} { return payload } -var E_ExtendFile = &protoimpl.ExtensionInfo{ +var E_ExtendFile = &proto.ExtensionDesc{ ExtendedType: (*descriptor.FileOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, @@ -55,7 +53,7 @@ var E_ExtendFile = &protoimpl.ExtensionInfo{ Filename: "extend.proto", } -var E_ExtendService = &protoimpl.ExtensionInfo{ +var E_ExtendService = &proto.ExtensionDesc{ ExtendedType: (*descriptor.ServiceOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, @@ -64,7 +62,7 @@ var E_ExtendService = &protoimpl.ExtensionInfo{ Filename: "extend.proto", } -var E_ExtendMethod = &protoimpl.ExtensionInfo{ +var E_ExtendMethod = &proto.ExtensionDesc{ ExtendedType: (*descriptor.MethodOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, @@ -73,7 +71,7 @@ var E_ExtendMethod = &protoimpl.ExtensionInfo{ Filename: "extend.proto", } -var E_ExtendEnum = &protoimpl.ExtensionInfo{ +var E_ExtendEnum = &proto.ExtensionDesc{ ExtendedType: (*descriptor.EnumOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, @@ -82,7 +80,7 @@ var E_ExtendEnum = &protoimpl.ExtensionInfo{ Filename: "extend.proto", } -var E_ExtendEnumValue = &protoimpl.ExtensionInfo{ +var E_ExtendEnumValue = &proto.ExtensionDesc{ ExtendedType: (*descriptor.EnumValueOptions)(nil), ExtensionType: (*bool)(nil), Field: 20000, @@ -110,15 +108,15 @@ var E_ExtendField = &proto.ExtensionDesc{ } func registerTestExtensions() { - protoregistry.GlobalTypes.RegisterExtension(E_ExtendFile) + proto.RegisterExtension(E_ExtendFile) extensions.SetTransformer(E_ExtendFile.Name, identity) - protoregistry.GlobalTypes.RegisterExtension(E_ExtendService) + proto.RegisterExtension(E_ExtendService) extensions.SetTransformer(E_ExtendService.Name, identity) - protoregistry.GlobalTypes.RegisterExtension(E_ExtendMethod) + proto.RegisterExtension(E_ExtendMethod) extensions.SetTransformer(E_ExtendMethod.Name, identity) - protoregistry.GlobalTypes.RegisterExtension(E_ExtendEnum) + proto.RegisterExtension(E_ExtendEnum) extensions.SetTransformer(E_ExtendEnum.Name, identity) - protoregistry.GlobalTypes.RegisterExtension(E_ExtendEnumValue) + proto.RegisterExtension(E_ExtendEnumValue) extensions.SetTransformer(E_ExtendEnumValue.Name, identity) proto.RegisterExtension(E_ExtendMessage) extensions.SetTransformer(E_ExtendMessage.Name, identity) From 2ec2cef718008aa34ce9d250a670eed5e1f4fbd9 Mon Sep 17 00:00:00 2001 From: Mostafa Date: Tue, 18 Jun 2024 22:01:00 +0800 Subject: [PATCH 6/6] fixing github action issue --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89f8cd3..c0432b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: go-version: ${{ matrix.go }} - name: Dependencies - run: go install github.com/haya14busa/goverage + run: go install github.com/haya14busa/goverage@latest - name: Tests run: |