Skip to content

Fix issue due to go/build.ImportDir change response on not found dir - #910

Merged
mattfarina merged 1 commit into
masterfrom
fix/go-import-err-change
Sep 18, 2017
Merged

Fix issue due to go/build.ImportDir change response on not found dir#910
mattfarina merged 1 commit into
masterfrom
fix/go-import-err-change

Conversation

@mattfarina

Copy link
Copy Markdown
Member

In go 1.9 there was a change to the way ImportDir, or rather Import
with a local "." package, responded when not found. Previously,
the error was an OS not found error that could be detected by
os.IsNotExist. Now the error is a custom go error using the format:

fmt.Errorf("cannot find package %q in:\n\t%s", path, p.Dir)

This change looks for both cases. For Go 1.9 is checks of it doesn't
exist because there are similar errors in go/build.

For more detail on the Go side of this see golang/go#21923

In go 1.9 there was a change to the way ImportDir, or rather Import
with a local "." package, responded when not found. Previously,
the error was an OS not found error that could be detected by
os.IsNotExist. Now the error is a custom go error using the format:

    fmt.Errorf("cannot find package %q in:\n\t%s", path, p.Dir)

This change looks for both cases. For Go 1.9 is checks of it doesn't
exist because there are similar errors in go/build.

For more detail on the Go side of this see golang/go#21923
@mattfarina

Copy link
Copy Markdown
Member Author

@sdboyer you might be interested in this error. Or, maybe you already have this one down.

@mattfarina
mattfarina merged commit 07a475d into master Sep 18, 2017
@mattfarina
mattfarina deleted the fix/go-import-err-change branch September 18, 2017 20:14
@sdboyer

sdboyer commented Sep 20, 2017

Copy link
Copy Markdown
Member

ah, thanks for the heads-up! we moved away from directly using build.ImportDir and rely directly on go/parser now, so we're set.

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.

2 participants