On Wed, Jun 3, 2020 at 7:33 PM Trig <edb1...@gmail.com> wrote:
>
> I posted this question the other day and don't see it (may have posted from 
> another gmail account and it's still pending approval)... so here I am again.
>
> Let's say I have something like below:
> type (
>    Person struct {
>       FirstName *string
>    }
> )
>
> Usually, I see something like the following when assigning:
> fn := "John"
> _ = Person{
>   FirstName: &fn,
> }
>
> Would something like the following be alright and acceptable practice:
> _ = Person{
>   FirstName: pString("John")
> }
>
>
> func pString(content string) *string {
>    return &content
> }

Sure, that's fine.

Ian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcV8RLnADr1kZaA46aNWtugrfzseT87_heT9_bJupZ_f3g%40mail.gmail.com.

Reply via email to