Skip to content
| Marketplace
Sign in
Visual Studio Code>Debuggers>Go Runner - Auto Restart ServerNew to Visual Studio Code? Get it now.
Go Runner - Auto Restart Server

Go Runner - Auto Restart Server

Astro Byte

|
11 installs
| (0) | Free
Automatically restart your Go server when files change. Perfect for development with hot reloading.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Go Runner - Auto Restart Server

🚀 The ultimate VS Code extension for Go development with hot reloading!

Automatically restart your Go server when files change, making development faster and more efficient. No more manual restarts - just code and see your changes instantly!

✨ Features

  • 🎯 One-command solution: Single command starts Go server with auto-restart enabled
  • 🔥 Smart file watching: Automatically restarts server when .go files change (excludes test files)
  • ⚡ Lightning fast: Optimized process management for quick restarts
  • 🛡️ Robust: Handles process cleanup, port conflicts, and edge cases
  • 🎛️ Configurable: Customize file watching patterns and exclusions
  • 📊 Detailed logging: View server logs and restart activity in VS Code output
  • 🧠 Intelligent: Ignores test files so you can write tests without interruption

🎮 Commands

Command Description Keyboard Shortcut
Go Runner: Start Go Server with Auto-Restart Start the Go server and enable file watching Ctrl+Shift+G S (Windows/Linux)
Cmd+Shift+G S (Mac)
Go Runner: Stop Go Server Stop the running Go server and disable file watching Ctrl+Shift+G X (Windows/Linux)
Cmd+Shift+G X (Mac)

🚀 Quick Start

  1. Install the extension from the VS Code Marketplace
  2. Open a Go project in VS Code (must have main.go or go.mod)
  3. Start the server: Press Ctrl+Shift+P → type "Go Runner" → select "Start Go Server with Auto-Restart"
  4. Code away! The server automatically restarts when you save .go files
  5. View logs in the "Go Runner" output channel
  6. Stop when done: Use "Go Runner: Stop Go Server" command

📋 Requirements

  • ✅ Go installed: Go must be installed and available in your PATH
  • ✅ Valid Go project: Your project should have a main.go file or go.mod file
  • ✅ VS Code 1.74+: Compatible with VS Code version 1.74.0 and above

⚙️ Configuration

Customize the extension behavior through VS Code settings:

Setting Description Default
goRunner.watchPatterns File patterns to watch for changes ["**/*.go"]
goRunner.excludePatterns File patterns to exclude from watching ["**/vendor/**", "**/node_modules/**", "**/*_test.go", "**/test/**"]

Example Configuration

{
  "goRunner.watchPatterns": ["**/*.go", "**/*.mod"],
  "goRunner.excludePatterns": [
    "**/vendor/**",
    "**/node_modules/**",
    "**/*_test.go",
    "**/test/**",
    "**/testdata/**"
  ]
}

🔧 How It Works

The extension uses advanced process management to ensure reliable server restarts:

  1. Process Groups: Creates detached process groups to track parent and child processes
  2. Smart Killing: Kills entire process trees, not just the parent go run process
  3. Port Cleanup: Automatically finds and kills processes using common Go server ports
  4. Debounced Restarts: Prevents multiple restarts from rapid file changes
  5. Error Recovery: Handles port conflicts and process cleanup automatically

🐛 Troubleshooting

Server won't start

  • ✅ Ensure Go is installed: go version
  • ✅ Check your project has main.go or go.mod
  • ✅ Verify no other process is using the port
  • ✅ Check the "Go Runner" output channel for errors

Server won't restart on file changes

  • ✅ Ensure you're editing .go files (not test files)
  • ✅ Check file patterns in settings
  • ✅ Verify the server is actually running
  • ✅ Try stopping and starting again

Port conflicts

  • ✅ The extension automatically handles port cleanup
  • ✅ If issues persist, manually kill processes: lsof -ti:8080 | xargs kill -9
  • ✅ Try using a different port in your Go code

Performance issues

  • ✅ Adjust goRunner.excludePatterns to ignore more files
  • ✅ Use more specific goRunner.watchPatterns
  • ✅ Ensure your project isn't too large

🤝 Contributing

Found a bug or want to contribute? We'd love your help!

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

📝 Changelog

See CHANGELOG.md for version history.

👨‍💻 Author

Sri Jayan E - Passionate Software Developer Publisher: astro-byte

📄 License

MIT License - see LICENSE file for details.


Made with ❤️ for the Go community

If you find this extension helpful, please ⭐ star the repository and leave a review!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft