Skip to content

cmd/go: document that directory patterns only match dirs in current module #27957

Open
@hyangah

Description

@hyangah

This involves both documentation and the implementation (which I don't know it's intended or something to fix). Feel free to split this issue if necessary.

All experiments here are done outside GOPATH.
I have a two module testmod2 and testmod2/cmd in one single repo.
The latest testmod2/cmd (v0.0.2) depends on testmod2/v2.
There are tests in testmod2/lib and testmod2/cmd packages.

$ git clone https://github.com/hyangah/testmod2.git /tmp/testmod2
$ cd /tmp/testmod2
$ go test ./...
ok  	github.com/hyangah/testmod2/v2/lib	0.021s

$ go test ./cmd/...
go: finding github.com/hyangah/testmod2/v2/cmd latest
can't load package: package github.com/hyangah/testmod2/v2/cmd: unknown import path "github.com/hyangah/testmod2/v2/cmd": cannot find module providing package github.com/hyangah/testmod2/v2/cmd
$ cd cmd
$ go test all
$ go test all
ok  	bufio	0.141s
ok  	bytes	1.862s
ok  	compress/bzip2	0.147s
--- FAIL: TestBlockHuff (0.00s)
    huffman_bit_writer_test.go:58: Testing "testdata/huffman-null-max.in"
    huffman_bit_writer_test.go:78: Output ok
    huffman_bit_writer_test.go:93: Reset ok
    huffman_bit_writer_test.go:365: EOF ok
    huffman_bit_writer_test.go:58: Testing "testdata/huffman-pi.in"
    huffman_bit_writer_test.go:78: Output ok
    huffman_bit_writer_test.go:93: Reset ok
    huffman_bit_writer_test.go:365: EOF ok
    huffman_bit_writer_test.go:58: Testing "testdata/huffman-rand-1k.in"
    huffman_bit_writer_test.go:78: Output ok
    huffman_bit_writer_test.go:93: Reset ok
    huffman_bit_writer_test.go:365: EOF ok
    huffman_bit_writer_test.go:58: Testing "testdata/huffman-rand-limit.in"
    huffman_bit_writer_test.go:78: Output ok
    huffman_bit_writer_test.go:93: Reset ok
    huffman_bit_writer_test.go:365: EOF ok
    huffman_bit_writer_test.go:58: Testing "testdata/huffman-rand-max.in"
    huffman_bit_writer_test.go:78: Output ok
    huffman_bit_writer_test.go:93: Reset ok
    huffman_bit_writer_test.go:365: EOF ok
    huffman_bit_writer_test.go:58: Testing "testdata/huffman-shifts.in"
    huffman_bit_writer_test.go:72: "testdata/huffman-shifts.in" != "testdata/huffman-shifts.golden" (see "testdata/huffman-shifts.in.got")
    huffman_bit_writer_test.go:74: open testdata/huffman-shifts.in.got: permission denied
    huffman_bit_writer_test.go:58: Testing "testdata/huffman-text-shift.in"
    huffman_bit_writer_test.go:72: "testdata/huffman-text-shift.in" != "testdata/huffman-text-shift.golden" (see "testdata/huffman-text-shift.in.got")
    huffman_bit_writer_test.go:74: open testdata/huffman-text-shift.in.got: permission denied
    huffman_bit_writer_test.go:58: Testing "testdata/huffman-text.in"
    huffman_bit_writer_test.go:72: "testdata/huffman-text.in" != "testdata/huffman-text.golden" (see "testdata/huffman-text.in.got")
    huffman_bit_writer_test.go:74: open testdata/huffman-text.in.got: permission denied
    huffman_bit_writer_test.go:58: Testing "testdata/huffman-zero.in"
    huffman_bit_writer_test.go:78: Output ok
    huffman_bit_writer_test.go:93: Reset ok
    huffman_bit_writer_test.go:365: EOF ok
FAIL
FAIL	compress/flate	9.319s
ok  	compress/gzip	0.057s
ok  	compress/lzw	0.128s
...

This unfortunate case I encountered is the failures from the tests in the standard libraries. The above error was because I have no permission to write to the GOROOT. I think that's not a rare setup so running standard library tests doesn't seem to be a right choice.

Metadata

Metadata

Assignees

Labels

DocumentationIssues describing a change to documentation.GoCommandcmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.modules

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions