Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit c1aba4d

Browse files
authored
Merge pull request #941 from JuFisch/FAQ-relative-imports
Add item on relative imports to FAQ
2 parents 44a454b + 67818ad commit c1aba4d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/FAQ.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Summarize the question and quote the reply, linking back to the original comment
2424
* [Why did `dep` use a different revision for package X instead of the revision in the lock file?](#why-did-dep-use-a-different-revision-for-package-x-instead-of-the-revision-in-the-lock-file)
2525
* [Why is `dep` slow?](#why-is-dep-slow)
2626
* [How does `dep` handle symbolic links?](#how-does-dep-handle-symbolic-links)
27+
* [Does `dep` support relative imports?](#does-dep-support-relative-imports)
2728

2829
## Best Practices
2930
* [Should I commit my vendor directory?](#should-i-commit-my-vendor-directory)
@@ -278,6 +279,15 @@ When `dep` is invoked with a project root that is a symlink, it will be resolved
278279

279280
This is the only symbolic link support that `dep` really intends to provide. In keeping with the general practices of the `go` tool, `dep` tends to either ignore symlinks (when walking) or copy the symlink itself, depending on the filesystem operation being performed.
280281

282+
## Does `dep` support relative imports?
283+
284+
No.
285+
> dep simply doesn't allow relative imports. this is one of the few places where we restrict a case that the toolchain itself allows. we disallow them only because:<br>
286+
> i. the toolchain already frowns heavily on them<br>
287+
> ii. it's worse for our case, as we start venturing into [dot dot hell](http://doc.cat-v.org/plan_9/4th_edition/papers/lexnames) territory when trying to prove that the import does not escape the tree of the project -[@sdboyer in #899](https://github.com/golang/dep/issues/899#issuecomment-317904001)
288+
289+
For a refresher on Go's recommended workspace organization, see the ["How To Write Go Code"](https://golang.org/doc/code.html) article in the Go docs. Organizing your code this way gives you a unique import path for every package.
290+
281291
## Best Practices
282292
### Should I commit my vendor directory?
283293

0 commit comments

Comments
 (0)