0

I have the following folders:

folder1:
   go.sum
   go.mod
   main.go

folder2:
   proto.pb.go

How in folder1 can I add the proto.pb.go as a dependency, so that files in folder1 can access to proto.pb.go?

Jing Huang
  • 41
  • 5
  • 1
    You cannot depend on "files" in Go. You can only depend on packages. – Jonathan Hall Oct 16 '20 at 07:29
  • Use the `replace` directive in `go.mod`. – icza Oct 16 '20 at 07:30
  • Yes, I actually meant for package, not files. How can I depend on another package in some other folder? We do want to keep the go.sum and go.mod under folder1. we can also create a go.mod under folder2. but we don't want to create a go.mod in one folder above them. – Jing Huang Oct 16 '20 at 22:09

0 Answers0