Importing from existing github project. Getting 'unknown revision' from mod tidy


I am using GO 1.22.1, Linux Mint and VSCode as development tools. I was a Java dev for many years. I think GO is the best thing since sliced bread :slight_smile:

The GO language is easy to learn but package management is really confusing!

I have a large GO project that I developed more to learn go than any thing else. It is a simple web server for my raspberry pi.

I have the project in github and have been progressing well until now.

I have a main file goWebApp.go and 7 packages within the main directory. For the main app I use replace in the go.mod file so I can work locally.

Originally I did not have go.mod files in the sub ‘packages’ but had difficulty with some packages importing other packages.

The project is at GitHub - stuartdd/goWebApp: Web app written in go for raspberry pi home server. Please don’t be too critical, this has been my playground for may years.

    | config # Package - No internal deps
    ----| config.go
        | go.mod
    | controllers # Package depends on runCommand & config
    ----| controllers.go
        | go.mod
    | image # Package - No internal deps
    ----| image.go
        | go.mod
    | runCommand # Package - No internal deps
    ----| runCommand.go
        | go.mod
    go.mod # Listed below
go 1.22.0

replace => ./config
replace => ./server
replace => ./logging
replace => ./controllers
replace => ./runCommand
replace => ./pictures
replace => ./image
require ( v1.0.0 v1.0.0 v1.0.0 v1.0.0
require ( v1.0.0 // indirect v1.0.0 // indirect


No go.sum file was created and I regularly build and run from command line.

I tried without go.mod files in the packages and was unable to import runCommand and config in to controllers.

I have created a v1.0.0 Release.

Current issue:

I am now creating a command line tool and want to reuse the code in the packages/modules from the goWebApp project but I have completely failed to import the code.

My new project go.mod is as follows:


go 1.22.0

require v1.0.0

When I go mod tidy I get the following:

go: downloading v0.0.0
go: downloading v0.0.0
go: downloading v0.0.0
go: downloading v0.0.0
go: imports imports reading at revision config/v0.0.0: unknown revision config/v0.0.0
go: imports imports reading at revision logging/v0.0.0: unknown revision logging/v0.0.0
go: imports imports reading at revision pictures/v0.0.0: unknown revision pictures/v0.0.0
go: imports imports reading at revision server/v0.0.0: unknown revision server/v0.0.0

I have cleaned cache and modcache with no impact.

If I change go.mod to require v0.0.0 I get:

go: downloading v0.0.0
go: imports reading at revision v0.0.0: unknown revision v0.0.0

I have tried for a couple of days, googling, reading, testing and repeat…


Can I include the modules/packages in goWebApp in another project or do I have to create new repositories for each module I want to reuse?

I believe I have structured goWebApp properly with github valid module names in go.mod files so where am I going wrong?

What is the best (and latest) way to structure a more complex project. A lot of the reading I have done is for old versions of GO and no longer valid!