When using Go sub-modules, you can prevent imports of parent modules by replacing the paths in go.mod to something non-existent, e.g.:
go.mod
https://github.com/etcd-io/etcd/blob/ee789c933e5f1cac02499dbd377ef0e3960220c6/api/go.mod#L32-L38