How to import local packages in go?

后端 未结 4 394
[愿得一人]
[愿得一人] 2020-12-04 08:28

I am new to go and working on an example code that I want to localize.

In the original main.go import statement it was:

 import (
    &quo         


        
4条回答
  •  借酒劲吻你
    2020-12-04 09:15

    Well, I figured out the problem. Basically Go starting path for import is $HOME/go/src

    So I just needed to add myapp in front of the package names, that is, the import should be:

    import (
        "log"
        "net/http"
        "myapp/common"
        "myapp/routers"
    )
    

提交回复
热议问题