Commit bb4fe7d
committed
Go: phase 5 — route go.mod tidy to the Java resolver; remove Go modgraph + Http
Complete the port: the GoModTidy recipe no longer resolves dependencies in the
Go peer. It now delegates the entire `go mod tidy` require-set computation to the
pure-Java resolver on the host via a new domain RPC method, GoModResolveTidy.
- core RewriteRpc: replace the generic, network-performing `Http` RPC method
with a `registerLanguageMethods(JsonRpc)` extension hook (called before bind)
and a protected getHttpSender(). The generic "host, fetch this URL for the
peer" capability — the SSRF/coupling concern raised in review — is gone from
the shared protocol.
- GoRewriteRpc: register GoModResolveTidy, which builds a CacheSource+ProxySource
from the request and runs Resolver + Tidy. All GOPROXY HTTP happens here, in
the host, through the configured HttpSender; GOPROXY=off resolves cache-only.
- Go side: resolveTidyViaJava sends {goMod, mainImports, modulePath,
separateIndirect, goproxy, gomodcache} and applies the returned require set;
computeTidySet calls it instead of the in-process resolver, falling back to the
LST-only pass when no resolver is installed (offline). The parse-time marker now
carries only the declared model; the resolved build list is computed on demand.
- Delete the Go pkg/parser/modgraph package (its algorithm now lives in Java) and
the parse-time resolveModuleGraph/moduleSource/fetchHTTP plumbing.
Tested: GoModResolveTidyTest drives the exact handler entry point (resolveTidy)
and matches `go mod tidy` for gin's pruning-completeness case, fetching over the
proxy via HttpSender. Full rewrite-go Java suite, rewrite-core rpc tests, and the
Go unit suite are green.
Note: a full modw corpus sweep could not be run here — the moderne-cli
core/serialization module does not compile against the workspace rewrite
(pre-existing API skew, 128 errors in V3LstReader: LstMetadata, ChangesetFilter,
EditPage, UsesMethod.getMethodPattern, …), so the dev fat jar cannot be rebuilt.
This is unrelated to these changes (none touch those files) and predates them
(the on-disk fat jar is from before this work).1 parent f1aeb35 commit bb4fe7d
15 files changed
Lines changed: 311 additions & 2357 deletions
File tree
- rewrite-core/src/main/java/org/openrewrite/rpc
- rewrite-go
- cmd/rpc
- pkg
- parser/modgraph
- recipe/golang
- src
- main/java/org/openrewrite/golang/rpc
- test/java/org/openrewrite/golang/rpc
- test
Lines changed: 20 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | 41 | | |
43 | | - | |
44 | | - | |
45 | 42 | | |
46 | | - | |
47 | 43 | | |
48 | 44 | | |
49 | 45 | | |
| |||
243 | 239 | | |
244 | 240 | | |
245 | 241 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
272 | 247 | | |
273 | 248 | | |
274 | 249 | | |
275 | 250 | | |
276 | 251 | | |
277 | | - | |
278 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
279 | 264 | | |
280 | 265 | | |
281 | 266 | | |
282 | 267 | | |
283 | 268 | | |
284 | 269 | | |
285 | 270 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
292 | 274 | | |
293 | 275 | | |
294 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
43 | | - | |
44 | 42 | | |
45 | 43 | | |
46 | 44 | | |
| |||
829 | 827 | | |
830 | 828 | | |
831 | 829 | | |
832 | | - | |
833 | | - | |
834 | | - | |
835 | | - | |
836 | | - | |
837 | | - | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
838 | 837 | | |
839 | 838 | | |
840 | | - | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
841 | 847 | | |
842 | 848 | | |
843 | | - | |
844 | | - | |
| 849 | + | |
| 850 | + | |
845 | 851 | | |
846 | 852 | | |
847 | 853 | | |
848 | 854 | | |
849 | | - | |
| 855 | + | |
850 | 856 | | |
851 | 857 | | |
852 | 858 | | |
853 | | - | |
| 859 | + | |
854 | 860 | | |
855 | 861 | | |
856 | 862 | | |
857 | 863 | | |
858 | 864 | | |
859 | 865 | | |
860 | | - | |
| 866 | + | |
861 | 867 | | |
862 | 868 | | |
863 | | - | |
864 | | - | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
865 | 872 | | |
866 | 873 | | |
867 | | - | |
868 | | - | |
869 | | - | |
870 | | - | |
871 | | - | |
872 | | - | |
873 | | - | |
874 | | - | |
875 | | - | |
876 | | - | |
877 | | - | |
878 | | - | |
879 | | - | |
880 | | - | |
881 | | - | |
882 | | - | |
883 | | - | |
884 | | - | |
885 | | - | |
886 | | - | |
887 | | - | |
888 | | - | |
889 | | - | |
890 | | - | |
| 874 | + | |
891 | 875 | | |
892 | | - | |
893 | | - | |
894 | | - | |
895 | | - | |
896 | | - | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | | - | |
901 | | - | |
902 | | - | |
903 | | - | |
904 | | - | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
913 | | - | |
914 | | - | |
915 | | - | |
916 | | - | |
917 | | - | |
918 | | - | |
919 | | - | |
920 | | - | |
| 876 | + | |
921 | 877 | | |
922 | 878 | | |
923 | 879 | | |
| |||
1164 | 1120 | | |
1165 | 1121 | | |
1166 | 1122 | | |
1167 | | - | |
1168 | | - | |
1169 | | - | |
1170 | | - | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
1171 | 1127 | | |
1172 | 1128 | | |
1173 | 1129 | | |
| |||
2083 | 2039 | | |
2084 | 2040 | | |
2085 | 2041 | | |
2086 | | - | |
2087 | | - | |
2088 | | - | |
| 2042 | + | |
| 2043 | + | |
2089 | 2044 | | |
2090 | 2045 | | |
2091 | 2046 | | |
| |||
This file was deleted.
0 commit comments