Importing local pakcages without breaking auto-completion

33 views
Skip to first unread message

Marwan abdel moneim

unread,
Oct 13, 2017, 2:02:29 PM10/13/17
to google-appengine-go
If I understand correctly, I should import a packages like "myapp/pkg" with just "pkg"
The problem with this is it breaks the auto-complete feature in my editor

Is there anyway to use the normal import path as you do in traditional go apps?

Ronoaldo José de Lana Pereira

unread,
Oct 18, 2017, 3:12:46 PM10/18/17
to Marwan abdel moneim, google-appengine-go
​Hi Marwan,

If I remember correctly, you can keep myapp outside of GOPATH and it should work.

Another option is to create your app directory, the one with handlers, as a leaf package with no sub-directories:

   myuser/
      myproject/
         pkg1/
         pkg2/
         app/
            handlers.go
            app.yaml

In app/handlers.go you can safely import github.com/myuser/myproject/pkg1 for instance. As long as app does not have any "child" packages this should work and you can keep your business logic reusable while deploying your app safely from GOPATH. This is what I use currently.

From handlers.go you import your handler. Since all will be in GOPATH and with proper imports, your autocomplete should work as expected.

--
You received this message because you are subscribed to the Google Groups "google-appengine-go" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine-go+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine-go/57861f35-c269-4402-9516-1172d8888f41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Ronoaldo Pereira
Reply all
Reply to author
Forward
0 new messages