Forrest logo
back to the goreload tool

goreload:tldr:0eef0

goreload: Set the name of the binary file to watch (defaults to `.goreload`).
$ goreload -b ${path-to-binary} ${filename}.go
try on your machine

This command is used to automatically restart a Go application when changes are made to the code. Let's break it down:

  • goreload is a command-line tool used for live reloading of Go applications.
  • -b flag stands for "build" and is used to compile the Go code into a binary executable.
  • ${path-to-binary} is a placeholder for the path where the binary executable will be created or is present. You need to replace it with the actual path.
  • ${filename}.go is another placeholder for the Go source file that you want to watch for changes. You need to replace ${filename} with the actual name of your Go file (without the extension ".go").

When you run this command, goreload will build the Go code into a binary based on the path specified by ${path-to-binary}. Then, it will monitor the specified ${filename}.go file for changes. Whenever you make changes and save the file, goreload will automatically recompile the code into a new binary, and restart the application using the updated binary.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the goreload tool