Multi-module single repo dependency issue

Summary:

Toying with a multi-module single repository project with what seems to be a possible cyclical dependency. But errors are a bit cryptic when issuing a go build inside pkg_1 to test it out:

go: github.com/xzjkya/gossip/net/ba00@v0.0.0 requires
        github.com/xzjkya/gossip@v0.0.0: reading github.com/xzjkya/gossip/go.mod at revision v0.0.0: unknown revision v0.0.0

Current folder structure is:

mod_1:
    go.mod
    pkg_1:
    dir_1:
        mod_1_1:
            go.mod
            pkg_1_1_1
            pkg_1_1_2
        mod_1_2:
            go.mod
            pkg_1_2_1
            pkg_1_2_2
        ...
    ...

mod_1.pkg_1 requires all *.pkg_1_*_2 inside dir_1 whereas all *.pkg_1_*_1 requires*.pkg_1_*_2 from their respective modules. e.g mod_1_1.pkg_1_1_1 requires mod_1_1.pkg_1_1_2 so on and so forth for each module inside dir_1. To be clearer hit branch. Root go.mod holds replace's and require's for each “submodule” with it’s path pointing down the directory structure. Same holds for each submodule go.mod, but going upwards to reference the root module. I know this is not the best structure for a microservice application, and this dependency/correlation hell proves me right, but what am I missing here? I read go module guide quite a few times while also inspecting projects with similar interdependency to no success.

Env:

Linux ? 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Go env:

GO111MODULE="on"
GOARCH="amd64"
GOBIN="/home/?/Documents/Personal/Go/bin"
GOCACHE="/home/?/.cache/go-build"
GOENV="/home/?/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY="github.com/xzjkya/gossip/net"
GONOSUMDB="github.com/xzjkya/gossip/net"
GOOS="linux"
GOPATH="/home/?/Documents/Personal/Go"
GOPRIVATE="github.com/xzjkya/gossip/net"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.13"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.13/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/?/Documents/Personal/Go/src/github.com/xzjkya/gossip/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build233173619=/tmp/go-build -gno-record-gcc-switches"

Expected behavior:

To compile or at least give me a less cryptic message.

Actual behavior:

Does not compile not does it gives me any better message.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.