0

This is the structure of my project:

src
  + github.com
      + myproject
          + services
              + utils
                  + nonce.go
              + myservice
                  + main.go

As you can see, myproject consists of two subprojects (i.e. utils and myservice).

main.go references the util package like this:

package main

import (
    "github.com/myproject/services/utils"
)

func main() {
    ...
    utils.DoSomething()
    ...
}

The utils package is not in github.com yet... but dep looks for this package at github.com. Is it possible to compile all the subprojects (and manage dependencies with dep) while the project is still local on my PC?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
j3d
  • 9,492
  • 22
  • 88
  • 172
  • 1
    `dep` can't currently do this. It needs to be able to fetch the repositories remotely. – JimB Sep 13 '17 at 17:58
  • The is roughly equivalent to how I've structured one of my projects. Originally I thought I'd separate the packages into different repos, but it ended up being awful and unnecessary for my project. Now it is working quite nicely to have the main repo directory have no files, just the directories for the different packages. Notably, it IS actually two AppEngine modules (API and webserver) in one repo that share the DB package abstraction. Thus far, I haven't needed to separate anything into different repos, but it wouldn't be difficult to do so. Just a possible suggestion, YMMV. – RayfenWindspear Sep 13 '17 at 18:29
  • Yes, I see... but in my real project, each subproject is a microservice that should be extended/maintained/built separately. – j3d Sep 13 '17 at 19:12
  • Just to clarify, you can put the packages wherever you want, and as long as they're locatable in GOPATH the program will compile. The fact that the packages can't be found on github.com yet is only a hinderance to sharing the code since `go get` won't work until they're there. The `dep` tool not using packages from GOPATH is a separate issue entirely, and is completely the fault of that tool, not with your packages. – JimB Sep 13 '17 at 21:00
  • out of curiosity, what dep command do you run ? –  Sep 13 '17 at 23:11
  • I run `dep init` the first time and then `dep ensure` whenever there is a new dependency. – j3d Sep 14 '17 at 19:43
  • This is basically [issue 792](https://github.com/golang/dep/issues/792) which is closed under "known/won't fix". I personally think they should make the simple case work, but they want a complete solution which is much less tractable. – JimB Sep 15 '17 at 12:56

0 Answers0