Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go2go: orderedmap.NewOrdered returns -1 for less than and greater than cases #41574

Closed
rcdmk opened this issue Sep 23, 2020 · 4 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.

Comments

@rcdmk
Copy link

rcdmk commented Sep 23, 2020

Hi folks,

I was talking a look at the nice code examples for generics in Go 2 path and found a small big in one of them.

What version of Go are you using (go version)? Go 2
What operating system and processor architecture are you using? N/A
What did you do? Read the code at /src/cmd/go2go/testdata/go2path/src/
What did you expect to see? Correct examples on how to use generics.
What did you see instead? One bug in orderedmap.NewOrdered.

switch {
case k1 < k2:
return -1
case k1 == k2:
return 0
default:
return -1
}

This probably shouldn't be negative 1:

@ALTree
Copy link
Member

ALTree commented Sep 23, 2020

cc @ianlancetaylor @griesemer

@ALTree ALTree changed the title Go 2 orderedmap.NewOrdered returns -1 for less than and greater than cases cmd/go2go: orderedmap.NewOrdered returns -1 for less than and greater than cases Sep 23, 2020
@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 23, 2020
@griesemer
Copy link
Contributor

Thanks. Yes, that looks like a typo.

@griesemer griesemer added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Sep 23, 2020
@gopherbot
Copy link

Change https://golang.org/cl/256718 mentions this issue: [dev.go2go] cmd/go2go: fix typo in test case

gopherbot pushed a commit that referenced this issue Sep 24, 2020
Fixes #41574.

Change-Id: I885f72bd68798b4ccdc539b062afa0d36debce4e
Reviewed-on: https://go-review.googlesource.com/c/go/+/256718
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
@griesemer
Copy link
Contributor

Fixed in dev.go2go repo. Thanks for reporting.

@golang golang locked and limited conversation to collaborators Sep 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants