Validate --address flag format in pipectl client options
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 364
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 84
Description
What would you like to be added:
Add address format validation to Options.Validate() in pkg/app/pipectl/client/client.go to catch malformed --address values before they reach grpc.DialContext().
Proposed approach:
- Use
net.SplitHostPortto validate standardhost:portformat (including IPv6 like[::1]:9000). - If that fails, fall back to
url.Parsefor gRPC resolver URIs (e.g.dns:///localhost:9000). - After both, verify the result has a non-empty host (for host:port) or scheme (for resolver URIs) — rejecting inputs that parse but carry no meaningful address, such as
://badorlocalhost(missing port). - Add table-driven unit tests using
testify/assertcovering valid, invalid, and edge cases.
Why is this needed:
Currently Options.Validate() only checks if --address is empty. Any non-empty malformed input passes through to grpc.DialContext(), producing cryptic multi-line transport errors like:
desc = "transport: Error while dialing: dial tcp: address localhost: missing port in address"
This is confusing for users and makes debugging harder. Since the Options struct is shared by all pipectl subcommands (application, deployment, encrypt, event, planpreview, transfer, plugin), this affects every pipectl user.
If this approach aligns with what you had in mind , I can proceed with the implementation . If you have a different approach in mind, I'm happy to adjust
Contributor guide
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 in pkg/app/pipectl/client/client.go at Options.Validate() and inspect nearby tests before running them. Add table-driven coverage for host:port, IPv6, resolver URIs, and malformed addresses using testify/assert. Done means invalid --address values are rejected before grpc.DialContext(), while valid addresses remain accepted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, grpc
- Domain
- cli, testing-qa
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 75/100