Go run

Go’s `go run` command is held up as an example of how simple tooling can make a compiled language feel almost script-like, especially with conventions like `go run .` and automatic dependency fetching. Commenters contrast this with JavaScript/TypeScript ecosystems, where multiple runtimes, module systems, and package managers can make basic tasks feel more complex, though newer tools like Deno and Bun try to close that gap. The exchange highlights broader trade‑offs between simplicity and flexibility in language design, error handling, build systems, and dependency management.

go run usage and conventions

  • Many note that go run main.go breaks once main is split across files; go run . runs the current package and works with multiple files and subdirs (go run ./cmd/foo).
  • Several complain that tutorials emphasize go run file.go instead of the simpler, more scalable go run ..
  • Some wish go run with no args would auto-detect a main package like other go subcommands, but others argue ambiguity with multiple cmd/* binaries.
  • Modules add friction: you often must be at the module root to go run ., or use -C to change directory.

Simplicity, conventions, and learning curve

  • Go is praised for predictable layout: directories as packages, cmd/ for binaries; navigating unfamiliar codebases tends to be straightforward.
  • Others find the “simple vs complex” boundary unintuitive (e.g., needing to know when to use go run . vs go run path/to/main.go).
  • There’s debate over how much prior-language expectations should shape Go tutorials and mental models.

Comparison with JS/TS and other ecosystems

  • Some contrast go run with Node/TypeScript’s ecosystem, citing fragmentation (npm, yarn, pnpm; CommonJS vs ESM; TS transpilation, Jest/Babel config).
  • Others counter that Node can already run ESM (.mjs), TS via simple tooling (tsc, loaders), and that newer tools (Deno, Bun, tsx, npx) make TS scripting similarly easy.
  • Rust’s cargo run, Python tools (Poetry), Nix and Bazel are mentioned as analogous “build + run” flows.

Dependency fetching and security

  • One highlighted feature: go run auto-downloads dependencies from module paths.
  • Supporters like the low-friction workflow, arguing versions are locked by go.mod/go.sum and backed by the Go proxy.
  • Critics see auto-fetching during run as a security/operational antipattern and prefer explicit “fetch then run” steps, especially for first-time downloads.

Broader views on Go

  • Many praise Go’s tooling (single toolchain, static binaries, cross-compilation, simple deployment; sometimes even obviating Docker).
  • Others criticize Go’s error-handling verbosity and lack of advanced type features compared to Rust or TypeScript, though some appreciate the explicitness.
  • Go is seen as sitting between low-level Rust and high-level TS, fitting well for backend services and small utilities but not satisfying everyone’s language tastes.