internal/commonmodels: malformed module path “internal/commonmodels”: missing dot in first path element

Issue

This Content is from Stack Overflow. Question asked by user2995358

I am using go version 1.19. My directory structure is as follows:

internal
  --awsutils
    --go.mod //content of the go.mod is
       replace internal/commonapiutils => ../../internal/commonapiutils
  --commonapiutils
    --go.mod  //content of the go.mod is
      replace internal/commonmodels => ../../internal/commonmodels
  --commonmodels
    --go.mod //content of the go.mod has entries for external packages
  --gcputils
    --go.mod //content of the go.mod is
       replace internal/commonapiutils => ../../internal/commonapiutils

Now, when I run “go mod tidy” on gcputils, commonmodels, commonapiutils there are no errors. But, when I run “go mod tidy” on awsutils it gives me an error:

go: found internal/commonapiutils in internal/commonapiutils v0.0.0-00010101000000-000000000000
internal/awsutils imports
    internal/commonapiutils imports
    internal/commonmodels: malformed module path "internal/commonmodels": missing dot in first path element



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?