Go Coding Style - Relative Package Import

Suppose I have a go project that includes many packages. in the example we can see this

-Project
---A
----aa
----ab
---B
----ba
----bb

Now during encoding. If I need to use the aa package methods in my bb , then the reserved way is to import as

import "github.com/user/project/A/aa"

But I saw that this package import also supports relative imports, like

import "./../../A/aa"

It will also import this package and allow mw to use methods.

Now my question is: I have not seen any such imports. So is this type of relative import prohibited? or is it allowed, but using it is just bad coding practice?

+4
source share

Source: https://habr.com/ru/post/1611870/


All Articles