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

[bridge] Change bridge name format in the config #170

Merged
merged 4 commits into from
Jun 17, 2019

Conversation

a-hilaly
Copy link
Collaborator

dealing with #157

if err != nil {
return nil, err
}
bridge.conf = conf

target := bridge.conf[keyTarget]
Copy link
Collaborator

Choose a reason for hiding this comment

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

That's pretty much the implementation of NewBridge(), so why the need to copy it instead of using it ? If you want to change the API to have LoadBridge instead, you should remove NewBridge() or at least deprecate it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The problem i encountered while writing this was that LoadBridge need to read the configuration before instantiating a bridge object, and since loadConfig() is a method of Bridge i was forced to do this.
NewBridge is used by git bug bridge configure who already knows the target name and want to instantiate a bridge directly.

What do you think of making loadConfig a more general function: something like loadConfig(repo *cache.Repo, name string) and then call NewBridge from LoadBridge to avoid code repetition ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

sounds good to me

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done !

@a-hilaly a-hilaly requested a review from MichaelMure June 16, 2019 21:06
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.

2 participants