Hello,

I like to work with stronger types so I try to avoid strings.
Given I have some JSON like 

---
const _test_data = `
{
  "name" : "myname",
  "uri" : "https://example.com/mycontext";
}
`
---

What I really would like to have is something like:

---

type Repository struct {
   Name string
   Uri  url.URL // replaced with MyURL
}

---

I ended up creating a custom type, however the conversion feels a little 
bit clumsy, see: https://play.golang.org/p/3gs8UK26ZfV. And MyURL is now 
missing all the nice methods of url.URL.

Thanks for hints :-)
Mirko

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to