FS#72209 - [go] package is missing all test files

Attached to Project: Community Packages
Opened by Daniel Martí (mvdan) - Wednesday, 22 September 2021, 15:02 GMT
Last edited by Morten Linderud (Foxboron) - Tuesday, 02 November 2021, 21:08 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Morten Linderud (Foxboron)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

In August, there was a change to make the go package smaller by removing "*_test.go" and testdata files from the source.

This means you can still use the toolchain and build std packages, but testing any of it is entirely broken.
For example, compare Arch's 1.17.1 versus my own source build of Go master:

```
$ wgo1 go version
go version go1.17.1 linux/amd64
$ wgo1 go test encoding/json
? encoding/json [no test files]
$ go version
go version devel go1.18-051df0d722 Wed Sep 22 03:45:00 2021 +0000 linux/amd64
$ go test encoding/json
ok encoding/json 0.533s
```

This is perhaps not critical, since most users might not notice. But I certainly have :)

The following is broken:

* Direct execution of "go test std"
* Running of "go test all" from third party modules, as nearly all import std packages
* Running third party tests that assume "std" is complete; such as https://github.com/rogpeppe/go-internal/blob/9df06c38c09b2cd3937f29c21bab94d9d165cd9d/imports/scan_test.go#L51-L53

These missing files were particularly confusing to me, because removed test files result in... no tests being run, silently.
So I do think that these files should be included in the main Go package, and not a separate "test files" package.
It's just far too easy to forget to install the latter.

As to whether or not it's OK to install std without test files: I'd say it's an incomplete install.
It happens to work for most people, but practically all software out there assumes GOROOT/src/std is complete.
This task depends upon

Closed by  Morten Linderud (Foxboron)
Tuesday, 02 November 2021, 21:08 GMT
Reason for closing:  Fixed
Additional comments about closing:  2:1.17.2-2
Comment by Morten Linderud (Foxboron) - Saturday, 23 October 2021, 18:52 GMT
I have essentially partially reverted the trimming change. We don't build dynlib nor race and rest of the files are back as expected.
Comment by Daniel Martí (mvdan) - Tuesday, 02 November 2021, 10:19 GMT
  • Field changed: Percent Complete (100% → 0%)
I might be missing something, but 2:1.17.2-1 still removes all testdata and *_test.go files, so my bug is not fixed :)
Comment by Morten Linderud (Foxboron) - Tuesday, 02 November 2021, 20:41 GMT
Sorry! Left some find commands there which I forgot about :/ 2:1.17.2-2 should fix this properly

Loading...