I am trying to create an API. This API uses a “store” with CRUD endpoints for each database table (or task). This means that there can be maybe 100 packages in folder “store”.
How do I import this into my main library?
By pointing to the folder only?
Or is there a better way to do this?
Folder name is “store” and I have tried with both package name “store” and “users”. And I have tried to import “store”, “main/store” and “api_server/main/store”. Get errors whatever.
I have go version go1.14.3 darwin/amd64. Does it helps to update?
I only tried relative imports once during my starting with go around 1.4 or 1.5… though dropped them right after the first couple of minutes as they caused errors (or warnings?) once I also added external dependencies…
Though relative imports should indeed be with leading dots as far as I remember.
Please where exactly have you tried store and users?
Given the code and folder architecture from Your op, I’d say you need to import "./store" and then users.Getusers().
Though I have no clue about your cat and posts.go, if the have not package users at the top, compilation should even fail, as there is only one package allowed per folder.
Package names and their import pathes do not necessarily need to match.