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

By default, the virtual host configured in the uri is used #238

Closed
wants to merge 1 commit into from

Conversation

cd365
Copy link

@cd365 cd365 commented Jan 5, 2024

Use virtual host in uri

"log"
"os"
"os/signal"
"syscall"
"time"

amqp "github.com/rabbitmq/amqp091-go"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this change due to your preference, or to a tool auto-formatting the code?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by go fmt

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there other example code that should be formatted as part of this PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go fmt ./... doesn't make this change for me 😕 Are you running go fmt with any special flag?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go fmt ./... doesn't make this change for me 😕 Are you running go fmt with any special flag?

Yes, you are right, I think my submitted code was automatically formatted by the development tool (goland); I hope you ignore the submission about here. Thanks

@@ -58,7 +59,6 @@ func setupCloseHandler(exitCh chan struct{}) {

func publish(ctx context.Context, publishOkCh <-chan struct{}, confirmsCh chan<- *amqp.DeferredConfirmation, confirmsDoneCh <-chan struct{}, exitCh chan struct{}) {
config := amqp.Config{
Vhost: "/",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does other example code use Vhost: when it's not necessary?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion is that the configured uri vhost should be used first. In other cases, you can configure it yourself.
Of course it's just my suggestion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#238 (comment)

I'm not sure I understand the benefit of this. IMO, having Vhost field set in the config is very clear, and it's better than relying in the implicit behaviour of URI parsing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#238 (comment)

I'm not sure I understand the benefit of this. IMO, having Vhost field set in the config is very clear, and it's better than relying in the implicit behaviour of URI parsing.

The reason why I modified it like this is because after I set the Vhost in the uri, I ran the code and reported an error. After comparison, I found that this was not the vhost I set.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is just my personal understanding. If you think the original way is better, I think my submission can be canceled. At the same time, I am also happy to communicate with you, thank you.

@lukebakken lukebakken self-assigned this Jan 5, 2024
@Zerpet
Copy link
Contributor

Zerpet commented Jan 8, 2024

I'm not sure I understand the improvement suggested in this PR. IMO, the current state is clear to what vhost the example is connecting to. Removing an explicit option and relying on implicit behaviour is arguably an improvement for an example.

@lukebakken lukebakken requested a review from Zerpet January 8, 2024 15:55
Copy link
Contributor

@Zerpet Zerpet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left review comments inline with Luke's review.

@cd365
Copy link
Author

cd365 commented Jan 11, 2024

I'm not sure I understand the improvement suggested in this PR. IMO, the current state is clear to what vhost the example is connecting to. Removing an explicit option and relying on implicit behaviour is arguably an improvement for an example.

This is what my PR meant, remove the explicit options and rely on the implicit behavior.

@cd365 cd365 closed this Jan 19, 2024
@cd365 cd365 deleted the w branch January 31, 2024 07:26
@cd365 cd365 restored the w branch January 31, 2024 07:27
@cd365 cd365 deleted the w branch February 26, 2024 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants