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

Update for juju/names refactor part 3 #103

Merged
merged 8 commits into from Jun 16, 2014
Merged

Update for juju/names refactor part 3 #103

merged 8 commits into from Jun 16, 2014

Conversation

davecheney
Copy link
Contributor

  • Replace all the calls to ParseTag(tag, hint) to a specific ParseXXXTag method.
  • Where ParseTag is not called with a hint, adjust as necessary, there is one call for this in the codebase.
  • Add some grossness where code like

type Unit struct { tag string }
func (u *Unit) Name() { _, id, err := names.ParseTag(tag, names.UnitTagKind); if err != nil { panic(err) } }

Into something a little more explicit using type specific ParseXXXTag methods.

In the next branch rather than storing the string form of the tag inside the Unit structure (without validation I may add), then parsing it (and possibly panicing) to get its Id, store a real Tag value in the struct then calls to name can just return the Id of the tag (or a more specific value available on the Tag's implementation type).

@howbazaar
Copy link
Contributor

LGTM

@davecheney
Copy link
Contributor Author

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Jun 16, 2014

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

jujubot added a commit that referenced this pull request Jun 16, 2014
Update for juju/names refactor part 3

* Replace all the calls to ParseTag(tag, hint) to a specific ParseXXXTag method. 
* Where ParseTag is not called with a hint, adjust as necessary, there is one call for this in the codebase.
* Add some grossness where code like

type Unit struct { tag string }
func (u *Unit) Name() { _, id, err := names.ParseTag(tag, names.UnitTagKind); if err != nil { panic(err) } }

Into something a little more explicit using type specific ParseXXXTag methods.

In the next branch rather than storing the string form of the tag inside the Unit structure (without validation I may add), then parsing it (and possibly panicing) to get its Id, store a real Tag value in the struct then calls to name can just return the Id of the tag (or a more specific value available on the Tag's implementation type).
@jujubot jujubot merged commit c3257b8 into juju:master Jun 16, 2014
@davecheney davecheney deleted the 106-parsetag-refactor branch April 13, 2016 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants