There is a package of Config and Services. Services need access to config. while doing so

import "../Config" 

And what other options are there?

The same question with the child package. For example, there is a Services and Services / ServiceName package, and for example, to use the methods from the ServiceName in the Services package, you have to:

 import "../Services/ServiceName" 

    1 answer 1

    The variant with relative paths can be used, BUT it works only if you compile the file directly, for example go build asd.go

    If you compile the entire package, the relative paths do not work and you need to prescribe the full path from $ GOPATH / src

    for example if there are packages

     github.com/rekby/tmp github.com/rekby/tmp/asd.go, export Func1 github.com/rekby/tmp/sub1 github.com/rekby/tmp/sub1/sub2 github.com/rekby/tmp/sub1/sub2/asd.go, export Func2 

    That (so that the code is always compiled regardless of the form of the call) in sub1 / main.go you need to write

     package main import ( "fmt" "github.com/rekby/tmp" "github.com/rekby/tmp/sub1/sub2" ) func main(){ fmt.Println(tmp.Func1(), sub2.Func2()) } 

    If you write

     import ( "fmt" tmp ".." "../sub1/sub2" ) func main(){ fmt.Println(tmp.Func1(), sub2.Func2()) } 

    then the code will be compiled only by calling "go build main.go", but NOT "go build" from the project folder or "go build github.com/rekby/tmp/sub1" or "go get github.com/rekby/tmp/sub1 "