owncloud / owncloud/protoc-gen-microweb
Code from a message-only proto file includes unused code
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 8
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
Steps to reproduce
- Create a message.proto file with only "Message" definition. It's intended to be used as common data type definition
- Create a service.proto file with a "Service" definition that imports from the message.proto file.
- Generate the code.
Current result
The generated code includes imports "net/http", "github.com/go-chi/chi/v5" and "github.com/go-chi/render" which aren't used.
Example generated code: https://github.com/jvillafanez/prototest001/blob/abf38bb9e4aa6da50ff0c97d59a26ba9905cffd6/gen/ocis/messages/v1/config.pb.web.go
Trying to use / compile the generated code fails.
...../github.com/jvillafanez/prototest001/gen@v0.0.0-20211202132711-abf38bb9e4aa/ocis/messages/v1/accounts.pb.web.go:9:2: imported and not used: "net/http"
...../github.com/jvillafanez/prototest001/gen@v0.0.0-20211202132711-abf38bb9e4aa/ocis/messages/v1/accounts.pb.web.go:11:2: imported and not used: "github.com/go-chi/chi/v5" as chi
...../github.com/jvillafanez/prototest001/gen@v0.0.0-20211202132711-abf38bb9e4aa/ocis/messages/v1/accounts.pb.web.go:12:2: imported and not used: "github.com/go-chi/render"
...../github.com/jvillafanez/prototest001/gen@v0.0.0-20211202132711-abf38bb9e4aa/ocis/messages/v1/config.pb.web.go:9:2: imported and not used: "net/http"
...../github.com/jvillafanez/prototest001/gen@v0.0.0-20211202132711-abf38bb9e4aa/ocis/messages/v1/config.pb.web.go:11:2: imported and not used: "github.com/go-chi/chi/v5" as chi
...../github.com/jvillafanez/prototest001/gen@v0.0.0-20211202132711-abf38bb9e4aa/ocis/messages/v1/config.pb.web.go:12:2: imported and not used: "github.com/go-chi/render"
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the message.proto and service.proto reproduction, then inspect the generated .pb.web.go files linked in the report. Generate code for a message-only proto import and compile the result to confirm the unused imports. Done means generated files for this case compile without unused net/http, chi, or render imports.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend-api-design, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100