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
Assignees
Labels

Comments

@rcdmk
Copy link

@rcdmk 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 ALTree commented Sep 23, 2020

@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
@griesemer
Copy link
Contributor

@griesemer griesemer commented Sep 23, 2020

Thanks. Yes, that looks like a typo.

@gopherbot
Copy link

@gopherbot gopherbot commented Sep 23, 2020

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

@griesemer griesemer commented Sep 24, 2020

Fixed in dev.go2go repo. Thanks for reporting.

@griesemer griesemer closed this Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.