Invalid imports in frontend.go - import locally?
yannjor opened this issue · 3 comments
These imports in knix/Sandbox/frontend/frontend.go
seem to be invalid, and all of these packages are in the .gitignore, so it doesn't really make sense to import them from github.
"github.com/microfn/microfunctions/Sandbox/frontend/localqueueservice"
"github.com/microfn/microfunctions/Sandbox/frontend/datalayermessage"
"github.com/microfn/microfunctions/Sandbox/frontend/datalayerservice"
Could these be imported locally instead?
Hi, thanks for filing this issue!
I dug a little and I think this has something to do with the way Go manages packages. See the following guide: https://golang.org/doc/code.html
Note that you don't need to publish your code to a remote repository before you can build it. A module can be defined locally without belonging to a repository. However, it's a good habit to organize your code as if you will publish it someday.
As such, the current 'develop' branch has been updated to reflect the current repository name (i.e., "github.com/microfn/microfunctions/" -> "github.com/knix-microfunctions/knix/"). The rest of the naming is still correct, because that's where the generated code will be (e.g., "Sandbox/frontend/localqueueservice").
And the .gitignore is set correctly to ignore these generated code, because they can always be generated (and can only create spurious commits).
@manuelstein: Do you have a better explanation regarding this?
No, @iakkus, thanks a lot for fixing the url-style package name and providing this great explanation. I've been meaning to make this change but it somehow slipped. Thanks, @yannjor for noticing.
I'd only add that it's not good practice to use local imports in a non-local repo and that's what this module should be. It lives at github.com/knix-microfunctions/knix/Sandbox/frontend, so also its submodules should be referred to using the non-local prefix.
@yannjor please let us know if you think otherwise.
Makes sense guys, thanks for the explanations. I compiled the KNIX Sandbox and now I don't get these errors anymore.