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

go/internal/gccgoimporter: gccgoimporter_test.go not updated after sort.Ints’ declaration was updated in Go 1.16.7 #47600

Closed
dilyanpalauzov opened this issue Aug 8, 2021 · 2 comments
Milestone

Comments

@dilyanpalauzov
Copy link

With

go version go1.16.5 gccgo (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1) linux/amd64

I do “git checkout go1.16.7 == commit fa6aa87”, then ./src/make.bask ; ./src/make.all . It fails with

ok go/format 0.018s
ok go/importer 0.109s
--- FAIL: TestInstallationImporter (1.73s)
importer_test.go:40: Ints: got "func Ints(x []int)"; want "func Ints(a []int)"
FAIL
FAIL go/internal/gccgoimporter 4.042s
ok go/internal/gcimporter 0.674s
ok go/internal/srcimporter 12.344s

The fails seems to origin in

commit af8748054b40e9a1e529e42a0f83cc2c90a35af6
Author: Russ Cox <rsc@golang.org>
Date:   Thu Oct 15 12:09:56 2020 -0400

    sort: update comments
    
    - Describe requirements on Less more precisely.
    - Standardize on x for the variable name of the data being sorted
      (was variously a, p, slice).
    - Many other minor wording changes.
    
    Fixes #41951.
    
    Change-Id: Ic9e222a53ec035fcc3b5ddfc7f0eefbe1bb2890d
    Reviewed-on: https://go-review.googlesource.com/c/go/+/262657
    Trust: Russ Cox <rsc@golang.org>
    Run-TryBot: Russ Cox <rsc@golang.org>
    Reviewed-by: Rob Pike <r@golang.org>


diff --git a/src/sort/sort.go b/src/sort/sort.go
index 4b3916e8a5..75e03435e0 100644
--- a/src/sort/sort.go
+++ b/src/sort/sort.go
@@ -4,30 +4,37 @@
@@ -313,20 +327,20 @@ func (p StringSlice) Sort() { Sort(p) }
 // Ints sorts a slice of ints in increasing order.
-func Ints(a []int) { Sort(IntSlice(a)) }
+func Ints(x []int) { Sort(IntSlice(x)) }

After this commit the test in

src/go/internal/gccgoimporter/gccgoinstallation_test.go:187: {pkgpath: "sort", name: "Ints", want: "func Ints(a []int)"},

was not adjusted.

Proposed patch:

diff --git a/src/go/internal/gccgoimporter/gccgoinstallation_test.go b/src/go/internal/gccgoimporter/gccgoinstallation_test.go
--- a/src/go/internal/gccgoimporter/gccgoinstallation_test.go
+++ b/src/go/internal/gccgoimporter/gccgoinstallation_test.go
@@ -184,7 +184,7 @@ func TestInstallationImporter(t *testing.T) {
                {pkgpath: "io", name: "ReadWriter", want: "type ReadWriter interface{Reader; Writer}"},
                {pkgpath: "math", name: "Pi", want: "const Pi untyped float"},
                {pkgpath: "math", name: "Sin", want: "func Sin(x float64) float64"},
-               {pkgpath: "sort", name: "Ints", want: "func Ints(a []int)"},
+               {pkgpath: "sort", name: "Ints", want: "func Ints(x []int)"},
                {pkgpath: "unsafe", name: "Pointer", want: "type Pointer"},
        } {
                runImporterTest(t, imp, nil, &test)
@gopherbot gopherbot added this to the Gccgo milestone Aug 8, 2021
@korzhao
Copy link
Contributor

korzhao commented Aug 8, 2021

#44425

@dmitshur dmitshur changed the title go/internal/gccgoimporter_test.go not updated after sort.Ints’ declaration was updated - v1.16.7 go/internal/gccgoimporter: gccgoimporter_test.go not updated after sort.Ints’ declaration was updated in Go 1.16.7 Aug 9, 2021
@ianlancetaylor
Copy link
Contributor

Thanks. This is a dup of #44425, which is fixed on tip and in the upcoming 1.17 release. I opened #47610 to backport that fix to the 1.16 release. Closing this issue. Thanks for reporting it.

@golang golang locked and limited conversation to collaborators Aug 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants