Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up consumer code #1084

Open
diorcety opened this issue Jun 28, 2024 · 5 comments
Open

Clean up consumer code #1084

diorcety opened this issue Jun 28, 2024 · 5 comments
Labels
proposal Enhancement idea or proposal

Comments

@diorcety
Copy link

diorcety commented Jun 28, 2024

Proposed change

Code at line https://github.com/nats-io/natscli/blob/main/cli/consumer_command.go#L1006 is not reachable

At line 1003 c.consumer is always != "" due to conditon at line 1002.

What is the expected behaviour?

Use case

Fix or remove dead code

Contribution

No response

@diorcety diorcety added the proposal Enhancement idea or proposal label Jun 28, 2024
@ripienaar
Copy link
Collaborator

Sorry, not sure which code you refer to, when linking to code its best to use permalinks then the links stay valid and shows your code even as the code changes.

Will close for now.

@diorcety
Copy link
Author

diorcety commented Aug 5, 2024

@ripienaar this code

return cfg, fmt.Errorf("durable consumer name in %s does not match CLI consumer name %s", c.inputFile, c.consumer)

		if cfg.Durable != "" && c.consumer != "" && cfg.Durable != c.consumer {
			if c.consumer != "" {
				cfg.Durable = c.consumer
			} else {
                                // Never reached
				return cfg, fmt.Errorf("durable consumer name in %s does not match CLI consumer name %s", c.inputFile, c.consumer)
			}
		}

@ripienaar
Copy link
Collaborator

indeed thats dead code, do you want to send a PR to fix?

@ripienaar ripienaar reopened this Aug 5, 2024
@diorcety
Copy link
Author

diorcety commented Aug 5, 2024

I fall on that issue during a modification I made in order to read a field "stream_name" from configuration file in order to create a consumer only from a json file cf (diorcety@78fc5a4)
But for this dead code, I can't figure what was the wanted behavior

@ripienaar
Copy link
Collaborator

It's probably just old code from a previous edit left over by accident

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Enhancement idea or proposal
Projects
None yet
Development

No branches or pull requests

2 participants