refraction-networking / water

WebAssembly Transport Executables Runtime
Apache License 2.0
22 stars 1 forks source link

`replace` directive is needed for all dependents #74

Open gaukas opened 2 months ago

gaukas commented 2 months ago

One of the external dependency of water, tetratelabs/wazero has been replaced with our fork, refraction-networking/wazero. However, Go itself will not inherit the replace directive in go.mod and therefore any dependents of this project must manually add the replace directive to their go.mod as well, making it challenging to maintain.

gaukas commented 2 months ago

We would love to seek out a long-term solution for this problem.

gaukas commented 1 month ago

By adding a dummy import path in our wazero fork in commit https://github.com/refraction-networking/wazero/commit/15dfe8eb50718971e30d69aaa4674bb4c0ac46e3, we allow water to import this directory at

must/replace/with/refraction-networking/wazero/fork

which does not and will not exist in the upstream tetratelabs/wazero repository. Therefore we managed to detect if replace directive is in use and will display the error message close to

wazero_config.go:13:2: no required module provides package github.com/tetratelabs/wazero/must/replace/with/refraction-networking/wazero/fork; to add it:
        go get github.com/tetratelabs/wazero/must/replace/with/refraction-networking/wazero/fork

which is relatively intuitive.

Additionally, we should mention the replace directive is a must in documentations (e.g., https://water.refraction.network/runtime/go.html).