{"id":39013195,"url":"https://github.com/agschwender/autoreload","last_synced_at":"2026-01-17T17:23:02.849Z","repository":{"id":64298684,"uuid":"567540496","full_name":"agschwender/autoreload","owner":"agschwender","description":"Automatically reloads an executable on change","archived":false,"fork":false,"pushed_at":"2022-11-22T00:35:07.000Z","size":30,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-09T09:17:59.858Z","etag":null,"topics":["autoreload","go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agschwender.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-18T02:15:16.000Z","updated_at":"2022-11-21T16:46:54.000Z","dependencies_parsed_at":"2023-01-15T09:01:31.882Z","dependency_job_id":null,"html_url":"https://github.com/agschwender/autoreload","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/agschwender/autoreload","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agschwender%2Fautoreload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agschwender%2Fautoreload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agschwender%2Fautoreload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agschwender%2Fautoreload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agschwender","download_url":"https://codeload.github.com/agschwender/autoreload/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agschwender%2Fautoreload/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28512727,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autoreload","go"],"created_at":"2026-01-17T17:23:02.776Z","updated_at":"2026-01-17T17:23:02.838Z","avatar_url":"https://github.com/agschwender.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GoDoc](http://godoc.org/github.com/agschwender/autoreload?status.svg)](http://godoc.org/github.com/agschwender/autoreload)\n\n# autoreload\n\n`autoreload` provides a package and command for automatically reloading an executable when that executable changes. It is intended to be used in a local development environment to reload the executable after it has been modified. An example use case would be to reload a go web app after you have edited the source code and recompiled the executable.\n\nThis approach can be useful when you prefer to manually rebuild your application instead of relying on functionality that watches your source files, recompiles the application and finally restarts it. In my experience, the manual approach to rebuilding allows for greater control of when it is triggered and provides more visibility on when it completes so that you can know that your changes are present when you retest. Additionally, if you run your local environment via Docker, e.g. something like [go-local](https://github.com/agschwender/go-local), this approach to reloading the application avoids having to install anything extra on your host machine.\n\n## Installation\n\n`autoreload` can be used as a package that is integrated into your application or as a command that is supplied an executable to monitor.\n\n### Installation via Package\n\nTo integrate the package into your application, follow the example below.\n\n```\npackage main\n\nimport (\n    \"github.com/agschwender/autoreload\"\n)\n\nfunc main() {\n    // Application setup\n    \n    autoreload.New().Start()\n\n    // Application run and waiting\n}\n```\n\nSee the [provided example](https://github.com/agschwender/autoreload/blob/main/example/main.go) for greater detail on how to integrate the package into your application.\n\n### Installation via Command\n\nTo integrate the command into your application, you must first install the `autoreload` command:\n\n```\n$ go install github.com/agschwender/autoreload/autoreloader@v1.1.2\n```\n\nOnce installed, you can then execute the command by supplying it with the executable you want it to monitor and restart. For example if you wanted to run your server command, it may look like this:\n\n```\n$ autoreloader server --port=8080\n```\n\n## Demo\n\nYou can verify the behavior of the package or command installation by using the provided `example` command.\n\nIn one terminal, compile the commands\n\n```\n$ go install ./...\n```\n\nIn another terminal, run\n\n```\n$ example\n2022/11/18 10:06:43 Starting application\n2022/11/18 10:06:43 Auto-reload is enabled\n2022/11/18 10:06:43 Starting HTTP server\n```\n\nChange the `example/main.go` file and then re-install, using the first terminal\n\n```\n$ go install ./...\n```\n\nYou should see the reload happen in your second terminal\n\n```\n2022/11/18 10:06:57 Executable changed; reloading process\n2022/11/18 10:06:57 Received change event, shutting down\n2022/11/18 10:06:58 Starting application\n2022/11/18 10:06:58 Auto-reload is enabled\n2022/11/18 10:06:58 Starting HTTP server 2\n```\n\nSimilarly, you can run via the `autoreloader` with the `example` command's built-in reloading turned off.\n\nIn your second terminal, run\n\n```\n$ autoreloader example --autoreload=false\n2022/11/18 10:10:11 Starting application\n2022/11/18 10:10:11 Starting HTTP server\n```\n\nAgain make a change to the `example/main.go` file and then re-install, using the first terminal\n\n```\n$ go install ./...\n```\n\nYou should see the reload happen in your second terminal\n\n```\n2022/11/18 10:11:08 Executable changed; reloading process\n2022/11/18 10:11:09 Killing process\n2022/11/18 10:11:09 Starting application\n2022/11/18 10:11:09 Starting HTTP server 2\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagschwender%2Fautoreload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagschwender%2Fautoreload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagschwender%2Fautoreload/lists"}