FAQ
Hello,
The delete function does not tell us if the specified key was removed or
not.
Is the caller expected to test that the map contains the key before
invoking delete ?
Thanks.

--
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/groups/opt_out.

Search Discussions

  • Andrey mirtchovski at Dec 10, 2013 at 8:12 pm
    see last sentence:

    http://golang.org/ref/spec#Deletion_of_map_elements

    --
    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/groups/opt_out.
  • Minux at Dec 10, 2013 at 8:13 pm

    On Dec 10, 2013 3:09 PM, wrote:
    The delete function does not tell us if the specified key was removed or not.
    Is the caller expected to test that the map contains the key before
    invoking delete ?
    you don't need to.

    delete is a no-op if the key doesn't exist.

    --
    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/groups/opt_out.
  • Caleb Spare at Dec 10, 2013 at 8:13 pm
    Yes.
    On Tuesday, December 10, 2013 12:09:27 PM UTC-8, gwenn...@gmail.com wrote:

    Hello,
    The delete function does not tell us if the specified key was removed or
    not.
    Is the caller expected to test that the map contains the key before
    invoking delete ?
    Thanks.
    --
    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/groups/opt_out.
  • Caleb Spare at Dec 10, 2013 at 8:15 pm
    (That is, you need to check if you want to know whether it existed. If you
    don't care, don't check.)
    On Tuesday, December 10, 2013 12:13:21 PM UTC-8, Caleb Spare wrote:

    Yes.
    On Tuesday, December 10, 2013 12:09:27 PM UTC-8, gwenn...@gmail.com wrote:

    Hello,
    The delete function does not tell us if the specified key was removed or
    not.
    Is the caller expected to test that the map contains the key before
    invoking delete ?
    Thanks.
    --
    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/groups/opt_out.
  • Chris dollin at Dec 10, 2013 at 8:16 pm

    On 10 December 2013 20:09, wrote:

    Hello,
    The delete function does not tell us if the specified key was removed or
    not.
    That's right. If you want to know if the key was in the map,
    you can check with `_, present := themap[theky]` (before deleting)
    and then testing `present`.

    Is the caller expected to test that the map contains the key before
    invoking delete ?
    No.

    Chris

    --
    Chris "allusive" Dollin

    --
    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/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 10, '13 at 8:09p
activeDec 10, '13 at 8:16p
posts6
users5
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase