Go Mod Private Repo导入路径(找不到模块)

I have this private GIT structure

github.com/my-company/project/webservices/service1

github.com/my-company/project/packages/stringslices

In the main() of the service1 package:

package main

import (
    slice "github.com/my-company/project/packages/stringslices"
)

func main() {
   data := []string{"a","b","c"}

    slice.SomeFunc(data)
}

when I try to build I get this error:

build github.com/my-company/project/webservices/service1: cannot find module for path github.com/my-company/project/packages/stringslices

My project is outside the GOPATH Each project has a go.mod file with it

How do I resolve this? Thanks!

might be a good idea to provide more information about your go version . . i have same experience as yours just a weeks ago. . i solved it with downgrading my go version to version 1.11.1 before i had 1.11.5 and also i check i had two go installed in my system try checking with command `which golang` ,, i've had the first golang in /usr/local/go which is my go version that i install manually and the other is from pacman package manager which is located in usr/local/bin ...

EDIT :

Oh yea, I remember now how to solve my problem :

  1. Remove go mod cache, mine was under ~/.cache directory, i dont know bout yours.
  2. Try build your code right away, under your project directory, go ahead and issue go build

EDIT 2 :

i got it now, turns out nothing to do with any of my answer above, just now i stumble ( again ) with this problem,, open up your go.mod file and edit the first line to :

module full/path/some/apiOfYours to just module apiOfYours