{"id":13827316,"url":"https://github.com/Teamwork/reload","last_synced_at":"2025-07-09T03:31:51.446Z","repository":{"id":26994215,"uuid":"101222596","full_name":"Teamwork/reload","owner":"Teamwork","description":"Lightweight automatic reloading of Go processes.","archived":false,"fork":false,"pushed_at":"2023-09-11T17:06:15.000Z","size":1212,"stargazers_count":187,"open_issues_count":4,"forks_count":13,"subscribers_count":57,"default_branch":"master","last_synced_at":"2024-11-11T10:15:49.073Z","etag":null,"topics":["go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Teamwork.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-08-23T20:34:45.000Z","updated_at":"2024-10-25T15:44:46.000Z","dependencies_parsed_at":"2024-01-15T16:23:48.458Z","dependency_job_id":"09d21f58-92cf-4b9e-8c29-22ecf94bdbc6","html_url":"https://github.com/Teamwork/reload","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Freload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Freload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Freload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Freload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Teamwork","download_url":"https://codeload.github.com/Teamwork/reload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225481520,"owners_count":17481174,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["go"],"created_at":"2024-08-04T09:01:53.918Z","updated_at":"2024-11-20T06:31:33.517Z","avatar_url":"https://github.com/Teamwork.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"[![GoDoc](https://godoc.org/github.com/teamwork/reload?status.svg)](https://godoc.org/github.com/teamwork/reload)\n[![Build Status](https://travis-ci.com/Teamwork/reload.svg?branch=master)](https://travis-ci.com/Teamwork/reload)\n[![codecov](https://codecov.io/gh/Teamwork/reload/branch/master/graph/badge.svg?token=n0k8YjbQOL)](https://codecov.io/gh/Teamwork/reload)\n\nLightweight automatic reloading of Go processes.\n\nAfter initialisation with `reload.Do()` any changes to the binary (and *only*\nthe binary) will restart the process. For example:\n\n```go\nfunc main() {\n    go func() {\n        err := reload.Do(log.Printf)\n        if err != nil {\n            panic(err) // Only returns initialisation errors.\n        }\n    }()\n\n    fmt.Println(os.Args)\n    fmt.Println(os.Environ())\n    ch := make(chan bool)\n    \u003c-ch\n}\n```\n\nNow use `go install` or `go build` to restart the process.\n\nAdditional directories can be watched using `reload.Dir()`; this is useful for\nreloading templates:\n\n```go\nfunc main() {\n    go func() {\n        err := reload.Do(log.Printf, reload.Dir(\"tpl\", reloadTpl))\n        if err != nil {\n            panic(err)\n        }\n    }()\n}\n```\n\nYou can also use `reload.Exec()` to manually restart your process without\ncalling `reload.Do()`.\n\n---\n\nThis is an alternative to the \"restart binary after any `*.go` file\nchanged\"-strategy that some other projects – such as\n[gin](https://github.com/codegangsta/gin) or\n[go-watcher](https://github.com/canthefason/go-watcher) – take.\nThe advantage of `reload`'s approach is that you have a more control over when\nthe process restarts, and it only watches a single directory for changes which\nhas some performance benefits, especially when used over NFS or Docker with a\nlarge number of files.\n\nIt also means you won't start a whole bunch of builds if you update 20 files in\na quick succession. On a desktop this probably isn't a huge deal, but on a\nlaptop it'll save some battery power.\n\nBecause it's in-process you can also do things like reloading just templates\ninstead of recompiling/restarting everything.\n\nCaveat: the old process will continue running happily if `go install` has a\ncompile error, so if you missed any compile errors due to switching the window\ntoo soon you may get confused.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTeamwork%2Freload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTeamwork%2Freload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTeamwork%2Freload/lists"}