I'm using the Go thrift package from Apache, which is at lib/go/thrift in the Git repo at git.apache.org/thrift.git. This is the import statement:
import "git.apache.org/thrift.git/lib/go/thrift"
This works fine for using the official Apache code but we needed to make a change to the Apache code so I just added a replace directive to the go.mod file for the project to pick up our changed version of the package:
replace git.apache.org/thrift.git/lib/go/thrift => <local_path>/lib/go/thrift
where <local_path> is where the (patched) git repo was saved. I added a go.mod file to this location (<local_path>/lib/go/thrift) simply containing this:
module git.apache.org/thrift.git/lib/go/thrift
go 1.12
However the Go compiler ($ go build) insists on downloading and using the Apache package and is ignoring the replace directive. Any ideas on the cause of this problem?