Skip to content

Conversation

anthonyfok
Copy link

@anthonyfok anthonyfok commented Nov 6, 2020

This solves the "unexpected directory layout" error when go test is
called like so: go test github.com/ianbruene/go-difflib/difflib/...

This was discovered when packaging github.com/ianbruene/go-difflib as golang-github-ianbruene-go-difflib for Debian:

   dh_auto_test -O--builddirectory=_build -O--buildsystem=golang
        cd _build && go test -vet=off -v -p 4 github.com/ianbruene/go-difflib/difflib github.com/ianbruene/go-difflib/difflib/bytes github.com/ianbruene/go-difflib/difflib/tester
unexpected directory layout:
        import path: _/<<PKGBUILDDIR>>/_build/src/github.com/ianbruene/go-difflib/difflib/tester
        root: /<<PKGBUILDDIR>>/_build/src
        dir: /<<PKGBUILDDIR>>/_build/src/github.com/ianbruene/go-difflib/difflib/tester
        expand root: /<<PKGBUILDDIR>>/_build
        expand dir: /<<PKGBUILDDIR>>/_build/src/github.com/ianbruene/go-difflib/difflib/tester
        separator: /
unexpected directory layout:
        import path: _/<<PKGBUILDDIR>>/_build/src/github.com/ianbruene/go-difflib/difflib/tester
        root: /<<PKGBUILDDIR>>/_build/src
        dir: /<<PKGBUILDDIR>>/_build/src/github.com/ianbruene/go-difflib/difflib/tester
        expand root: /<<PKGBUILDDIR>>/_build
        expand dir: /<<PKGBUILDDIR>>/_build/src/github.com/ianbruene/go-difflib/difflib/tester
        separator: /
dh_auto_test: error: cd _build && go test -vet=off -v -p 4 github.com/ianbruene/go-difflib/difflib github.com/ianbruene/go-difflib/difflib/bytes github.com/ianbruene/go-difflib/difflib/tester returned exit code 1

I've already applied the patch for the Debian package (see https://salsa.debian.org/go-team/packages/golang-github-ianbruene-go-difflib/-/blob/debian/sid/debian/patches/01-fix-unexpected-directory-layout-error-during-go-test.patch) so it is OK on the Debian side.

Please feel free to merge this PR or not depending on your preference on relative import paths vs. full paths.
(I was reading the debate at golang/go#20883 and realized both sides have good arguments...)

Many thanks!

Cheers,
Anthony

This solves the "unexpected directory layout" error when "go test" is
called like so: "go test github.com/ianbruene/go-difflib/difflib/..."
@rcoreilly
Copy link

This is now a blocking bug on go 1.18 -- go mod tidy chokes on it. any chance you could apply this PR?

@Dorbmon
Copy link

Dorbmon commented May 28, 2022

Yes. Now it stops me from compiling it...

@ianbruene
Copy link
Owner

Closing, and handled in just merged PR #12

@ianbruene ianbruene closed this Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants