Rewrite your app in Rust, piece by piece, checked against the original at every step. Works with TypeScript, JavaScript, Python, Go, Ruby, Java, C, PHP, C#, Kotlin, PowerShell and Swift.
Rust agent-skillsclaude-codeclicode-migrationcodexffigolangjavajavascriptmcpmigrationnapiperformanceportingpyo3pythonrewriterubyrusttypescript
Go: count os.Getpid and os.Getuid as environment reads, and time.Until as a clock read (#1479)
Hashem Alkhanaizie0a04b5eada4
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 7e66b8b2..dbf654f9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,9 @@## Unreleased+- Go: `os.Getpid()`, `os.Getppid()`, `os.Getuid()` and `os.Getgid()` count as reading the+ environment, and `time.Until()` as reading the clock, the mirror of `time.Since()`, so `bridge`+ keeps a function that calls one in Go and `analyze` counts it (#1455).- npm: `rust-anything` no longer bundles the binaries of all five platforms (210 MB unpacked). Eachplatform's binary is its own package (`rust-anything-darwin-arm64`, `-darwin-x64`, `-linux-arm64`,`-linux-x64`, `-win32-x64`), listed as an optional dependency, so `npm install` and `npx` fetch onlydiff --git a/src/lang/effects.rs b/src/lang/effects.rsindex 6b397b24..d4f75530 100644--- a/src/lang/effects.rs+++ b/src/lang/effects.rs@@ -177,6 +177,10 @@ fn environment(lang: Lang) -> &'static [&'static str] {"os.UserConfigDir(","os.UserCacheDir(","os.Executable(",+ "os.Getpid(",+ "os.Getppid(",+ "os.Getuid(",+ "os.Getgid(",],Lang::Java | Lang::Kotlin => &["System.getenv(",@@ -269,7 +273,7 @@ fn clock_and_random(lang: Lang) -> &'static [&'static str] {"uuid.uuid","secrets.",],- Lang::Go => &["time.Now(", "rand.", "time.Since("],+ Lang::Go => &["time.Now(", "rand.", "time.Since(", "time.Until("],Lang::Java | Lang::Kotlin => &["System.currentTimeMillis(","System.nanoTime(",@@ -1719,6 +1723,10 @@ mod tests {Lang::Go,"func F(x string) string { return os.TempDir() + x }",),+ (+ Lang::Go,+ "func F(x string) string { return strconv.Itoa(os.Getpid()) + x }",+ ),(Lang::Java,"String f(String x){ return System.getenv(\"HOME\") + x; }",@@ -1749,6 +1757,14 @@ mod tests {);}// The clock matters when nothing is passed: one recorded case is one moment.+ assert!(+ reason(+ Lang::Go,+ &[],+ "func Left() int64 {\n\treturn int64(time.Until(deadline).Seconds())\n}\n"+ )+ .is_some()+ );assert!(reason(Lang::Python, &[], "def f():\n return time.time()").is_some());for body in ["time.strftime('%Y')", "datetime.today()"] {let code = format!("def f():\n return {body}");