FAQ
Something like


type A struct {
Root string const
Name string
}

Where Root is a constant for this struct which never changes .

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Ian Lance Taylor at Mar 4, 2016 at 10:44 pm

    On Fri, Mar 4, 2016 at 2:40 PM, wrote:
    Something like


    type A struct {
    Root string const
    Name string
    }

    Where Root is a constant for this struct which never changes .
    No, sorry. I assume you want something like a field Root that is set
    at initialization and never changed thereafter. Go doesn't support
    anything like that. It would mean that the type had no useful zero
    value (

    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Tyler Compton at Mar 4, 2016 at 11:47 pm
    If you're curious about why this doesn't exist, take a look at this ticket:

    https://github.com/golang/go/issues/359
    On Friday, March 4, 2016 at 3:40:09 PM UTC-7, krma...@gmail.com wrote:

    Something like


    type A struct {
    Root string const
    Name string
    }

    Where Root is a constant for this struct which never changes .
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 4, '16 at 10:40p
activeMar 4, '16 at 11:47p
posts3
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase