[go] flag: remove "// BUG" comment

9 views
Skip to first unread message

Gerrit Bot (Gerrit)

unread,
Oct 13, 2022, 12:52:19 PM10/13/22
to goph...@pubsubhelper.golang.org, Zamicol Zamicol, golang-co...@googlegroups.com

Gerrit Bot has uploaded this change for review.

View Change

flag: remove "// BUG" comment

Remove a vestigial " // BUG" comment as there is no bug in the relevant code section and comment predated other changes. Also removed a needless allocation and conformed to the "v, ok := a[x]" standard convention. Tests are passing.

Change-Id: Id28ad1baf77447052b54b341f018e573bac0c11a
GitHub-Last-Rev: c41beab74af7d8aaf1eec18e01d3afcc22830411
GitHub-Pull-Request: golang/go#56210
---
M src/flag/flag.go
1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/flag/flag.go b/src/flag/flag.go
index f6b3890..01dc38c 100644
--- a/src/flag/flag.go
+++ b/src/flag/flag.go
@@ -1056,9 +1056,9 @@
break
}
}
- m := f.formal
- flag, alreadythere := m[name] // BUG
- if !alreadythere {
+
+ flag, ok := f.formal[name]
+ if !ok {
if name == "help" || name == "h" { // special case for nice help message.
f.usage()
return false, ErrHelp

To view, visit change 442815. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Id28ad1baf77447052b54b341f018e573bac0c11a
Gerrit-Change-Number: 442815
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-MessageType: newchange

Rob Pike (Gerrit)

unread,
Oct 13, 2022, 4:27:20 PM10/13/22
to Zamicol Zamicol, Gerrit Bot, goph...@pubsubhelper.golang.org, Rob Pike, Gopher Robot, golang-co...@googlegroups.com

Patch set 1:Run-TryBot +1Code-Review +2

View Change

    To view, visit change 442815. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Id28ad1baf77447052b54b341f018e573bac0c11a
    Gerrit-Change-Number: 442815
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Rob Pike <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Comment-Date: Thu, 13 Oct 2022 20:27:14 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Ian Lance Taylor (Gerrit)

    unread,
    Oct 13, 2022, 7:13:00 PM10/13/22
    to Zamicol Zamicol, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Rob Pike, golang-co...@googlegroups.com

    View Change

    1 comment:

    • File src/flag/flag.go:

      • Patch Set #1, Line 1060: flag, ok := f.formal[name]

        Please remove the trailing whitespace (running gofmt should do that). Thanks.

    To view, visit change 442815. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Id28ad1baf77447052b54b341f018e573bac0c11a
    Gerrit-Change-Number: 442815
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Rob Pike <r...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@google.com>
    Gerrit-Comment-Date: Thu, 13 Oct 2022 23:12:53 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Gerrit Bot (Gerrit)

    unread,
    Oct 13, 2022, 11:10:36 PM10/13/22
    to Zamicol Zamicol, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Rob Pike.

    Gerrit Bot uploaded patch set #2 to this change.

    View Change

    The following approvals got outdated and were removed: Run-TryBot+1 by Rob Pike, TryBot-Result+1 by Gopher Robot

    flag: remove "// BUG" comment

    Remove a vestigial " // BUG" comment as there is no bug in the relevant code section and comment predated other changes. Also removed a needless allocation and conformed to the "v, ok := a[x]" standard convention. Tests are passing.

    Change-Id: Id28ad1baf77447052b54b341f018e573bac0c11a
    GitHub-Last-Rev: 26084698bfc0972d7e0fec0de4f31cc87e3a5f7a

    GitHub-Pull-Request: golang/go#56210
    ---
    M src/flag/flag.go
    1 file changed, 16 insertions(+), 3 deletions(-)

    To view, visit change 442815. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Id28ad1baf77447052b54b341f018e573bac0c11a
    Gerrit-Change-Number: 442815
    Gerrit-PatchSet: 2
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Rob Pike <r...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@google.com>
    Gerrit-Attention: Rob Pike <r...@golang.org>
    Gerrit-MessageType: newpatchset

    Ian Lance Taylor (Gerrit)

    unread,
    Oct 14, 2022, 4:20:19 PM10/14/22
    to Zamicol Zamicol, Gerrit Bot, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Gopher Robot, Rob Pike, golang-co...@googlegroups.com

    Attention is currently required from: Ian Lance Taylor, Rob Pike.

    View Change

    1 comment:

    • File src/flag/flag.go:

      • Patch Set #1, Line 1060: flag, ok := f.formal[name]

        Please remove the trailing whitespace (running gofmt should do that). Thanks.

      • Done

    To view, visit change 442815. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Id28ad1baf77447052b54b341f018e573bac0c11a
    Gerrit-Change-Number: 442815
    Gerrit-PatchSet: 2
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Rob Pike <r...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@google.com>
    Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
    Gerrit-Attention: Rob Pike <r...@golang.org>
    Gerrit-Comment-Date: Fri, 14 Oct 2022 20:20:15 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Ian Lance Taylor <ia...@google.com>
    Gerrit-MessageType: comment

    Ian Lance Taylor (Gerrit)

    unread,
    Oct 14, 2022, 4:20:35 PM10/14/22
    to Zamicol Zamicol, Gerrit Bot, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Gopher Robot, Rob Pike, golang-co...@googlegroups.com

    Attention is currently required from: Rob Pike.

    Patch set 2:Run-TryBot +1Auto-Submit +1Code-Review +2

    View Change

    1 comment:

    To view, visit change 442815. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Id28ad1baf77447052b54b341f018e573bac0c11a
    Gerrit-Change-Number: 442815
    Gerrit-PatchSet: 2
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
    Gerrit-Reviewer: Rob Pike <r...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Rob Pike <r...@golang.org>
    Gerrit-Comment-Date: Fri, 14 Oct 2022 20:20:31 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    David Chase (Gerrit)

    unread,
    Oct 17, 2022, 10:49:55 AM10/17/22
    to Zamicol Zamicol, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Ian Lance Taylor, Rob Pike, golang-co...@googlegroups.com

    Attention is currently required from: Rob Pike.

    Patch set 2:Code-Review +1

    View Change

      To view, visit change 442815. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Id28ad1baf77447052b54b341f018e573bac0c11a
      Gerrit-Change-Number: 442815
      Gerrit-PatchSet: 2
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: David Chase <drc...@google.com>
      Gerrit-Reviewer: Gopher Robot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
      Gerrit-Reviewer: Rob Pike <r...@golang.org>
      Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Rob Pike <r...@golang.org>
      Gerrit-Comment-Date: Mon, 17 Oct 2022 14:49:46 +0000

      Gopher Robot (Gerrit)

      unread,
      Oct 17, 2022, 10:50:48 AM10/17/22
      to Zamicol Zamicol, Gerrit Bot, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, David Chase, Ian Lance Taylor, Rob Pike, golang-co...@googlegroups.com

      Gopher Robot submitted this change.

      View Change


      Approvals: Ian Lance Taylor: Looks good to me, approved; Run TryBots; Automatically submit change Gopher Robot: TryBots succeeded Rob Pike: Looks good to me, approved David Chase: Looks good to me, but someone else must approve
      flag: remove "// BUG" comment

      Remove a vestigial " // BUG" comment as there is no bug in the relevant code section and comment predated other changes. Also removed a needless allocation and conformed to the "v, ok := a[x]" standard convention. Tests are passing.

      Change-Id: Id28ad1baf77447052b54b341f018e573bac0c11a
      GitHub-Last-Rev: 26084698bfc0972d7e0fec0de4f31cc87e3a5f7a
      GitHub-Pull-Request: golang/go#56210
      Reviewed-on: https://go-review.googlesource.com/c/go/+/442815
      Reviewed-by: Ian Lance Taylor <ia...@google.com>
      Reviewed-by: David Chase <drc...@google.com>
      Auto-Submit: Ian Lance Taylor <ia...@google.com>
      Run-TryBot: Ian Lance Taylor <ia...@google.com>
      Reviewed-by: Rob Pike <r...@golang.org>
      TryBot-Result: Gopher Robot <go...@golang.org>
      ---
      M src/flag/flag.go
      1 file changed, 23 insertions(+), 3 deletions(-)

      diff --git a/src/flag/flag.go b/src/flag/flag.go
      index f6b3890..ef3cf29 100644

      --- a/src/flag/flag.go
      +++ b/src/flag/flag.go
      @@ -1056,9 +1056,9 @@
      break
      }
      }
      - m := f.formal
      - flag, alreadythere := m[name] // BUG
      - if !alreadythere {
      +
      +	flag, ok := f.formal[name]

      + if !ok {
      if name == "help" || name == "h" { // special case for nice help message.
      f.usage()
      return false, ErrHelp

      To view, visit change 442815. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Id28ad1baf77447052b54b341f018e573bac0c11a
      Gerrit-Change-Number: 442815
      Gerrit-PatchSet: 3
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: David Chase <drc...@google.com>
      Gerrit-Reviewer: Gopher Robot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
      Gerrit-Reviewer: Rob Pike <r...@golang.org>
      Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
      Gerrit-MessageType: merged
      Reply all
      Reply to author
      Forward
      0 new messages