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

x/vgo: vendor testdata from parent directories of copied packages #23997

Closed
artyom opened this issue Feb 21, 2018 · 3 comments
Closed

x/vgo: vendor testdata from parent directories of copied packages #23997

artyom opened this issue Feb 21, 2018 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@artyom
Copy link
Member

artyom commented Feb 21, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.10 darwin/amd64 vgo:2018-02-20.1

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

Please see this example repository: https://github.com/artyom/vgo-test1

There are two files: main.go importing golang.org/x/image/tiff and go.mod specifying dependency.

It seems that currently result of the vgo test all execution depends on whether vendor directory present or not. If there's no vendor directory, test succeeds:

vgo-test1 (master) ¶ vgo test all
?   	github.com/artyom/vgo-test1	[no test files]
ok  	golang.org/x/image/tiff	(cached)
?   	golang.org/x/image/tiff/lzw	[no test files]

After vgo vendor call that populates vendor directory, vgo test all fails because testdata is not vendored (while *_test.go files are):

vgo-test1 (master) ¶ vgo vendor
vgo-test1 (master) ¶ find vendor -name testdata
vgo-test1 (master) ¶ find vendor -name \*_test.go
vendor/golang.org/x/image/tiff/writer_test.go
vendor/golang.org/x/image/tiff/buffer_test.go
vendor/golang.org/x/image/tiff/reader_test.go

It seems that vgo should either vendor testdata directories or ignore them completely as stated in introductory tour:

In order to provide for a graceful transition, vgo-based builds ignore vendor directories entirely [...]

What did you expect to see?

vgo-test1 (master) ¶ vgo vendor
vgo-test1 (master) ¶ vgo test all
?   	github.com/artyom/vgo-test1	[no test files]
ok  	golang.org/x/image/tiff	(cached)
?   	golang.org/x/image/tiff/lzw	[no test files]

What did you see instead?

vgo-test1 (master) ¶ vgo vendor
vgo-test1 (master) ¶ vgo test all
?   	github.com/artyom/vgo-test1	[no test files]
--- FAIL: TestNoRPS (0.00s)
	reader_test.go:47: open ../testdata/no_rps.tiff: no such file or directory
--- FAIL: TestNoCompression (0.00s)
	reader_test.go:57: open ../testdata/no_compress.tiff: no such file or directory
--- FAIL: TestShortBlockData (0.00s)
	reader_test.go:85: open ../testdata/bw-uncompressed.tiff: no such file or directory
--- FAIL: TestDecodeInvalidDataType (0.00s)
	reader_test.go:111: open ../testdata/bw-uncompressed.tiff: no such file or directory
--- FAIL: TestDecode (0.00s)
	reader_test.go:155: open ../testdata/video-001.png: no such file or directory
--- FAIL: TestDecodeLZW (0.00s)
	reader_test.go:185: open ../testdata/blue-purple-pink.png: no such file or directory
--- FAIL: TestDecodeTagOrder (0.00s)
	reader_test.go:200: open ../testdata/video-001.tiff: no such file or directory
--- FAIL: TestDecompress (0.00s)
	reader_test.go:225: decoding bw-uncompressed.tiff: open ../testdata/bw-uncompressed.tiff: no such file or directory
--- FAIL: TestZeroBitsPerSample (0.00s)
	reader_test.go:264: open ../testdata/bw-deflate.tiff: no such file or directory
--- FAIL: TestTileTooBig (0.00s)
	reader_test.go:292: open ../testdata/video-001-tile-64x64.tiff: no such file or directory
--- FAIL: TestRoundtrip (0.00s)
	writer_test.go:43: open ../testdata/video-001.tiff: no such file or directory
FAIL
FAIL	github.com/artyom/vgo-test1/vendor/golang.org/x/image/tiff	0.012s
?   	github.com/artyom/vgo-test1/vendor/golang.org/x/image/tiff/lzw	[no test files]
ok  	golang.org/x/image/tiff	(cached)
?   	golang.org/x/image/tiff/lzw	[no test files]
@gopherbot gopherbot added this to the vgo milestone Feb 21, 2018
@artyom artyom changed the title x/vgo: inconsisten handling of vendor directory x/vgo: inconsistent handling of vendor directory Feb 21, 2018
@while-loop
Copy link

while-loop commented Feb 21, 2018

I think if we prune vendored deps, then we should not include *_test.go files. I'm not sure if there is way for go to know what directories/files are used in tests consistently.

@rsc
Copy link
Contributor

rsc commented Apr 2, 2018

It's important to keep the tests. You should run tests of your dependencies, especially if you've put them into a new, previously-untested configuration. The testdata issue is interesting. We could just keep all the testdata directories in parent directories of copied packages too.

@rsc rsc changed the title x/vgo: inconsistent handling of vendor directory x/vgo: vendor testdata from parent directories of copied packages Apr 2, 2018
@rsc rsc added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 2, 2018
@gopherbot
Copy link

Change https://golang.org/cl/116575 mentions this issue: cmd/go/internal/vgo: vendor testdata from parent directories of copied packages

@golang golang locked and limited conversation to collaborators Jun 14, 2019
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

4 participants