{"id":22974049,"url":"https://github.com/bolcom/muts","last_synced_at":"2025-08-13T14:33:38.070Z","repository":{"id":3764559,"uuid":"50036982","full_name":"bolcom/muts","owner":"bolcom","description":"Go package with utilities to create shell and make-like files in Go","archived":false,"fork":false,"pushed_at":"2022-06-30T17:02:40.000Z","size":29,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-06-20T11:06:04.586Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bolcom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-20T14:55:19.000Z","updated_at":"2022-06-30T17:02:43.000Z","dependencies_parsed_at":"2022-09-20T17:48:54.853Z","dependency_job_id":null,"html_url":"https://github.com/bolcom/muts","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bolcom%2Fmuts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bolcom%2Fmuts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bolcom%2Fmuts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bolcom%2Fmuts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bolcom","download_url":"https://codeload.github.com/bolcom/muts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229767228,"owners_count":18121043,"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":[],"created_at":"2024-12-14T23:59:58.378Z","updated_at":"2024-12-14T23:59:58.971Z","avatar_url":"https://github.com/bolcom.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"### muts - Go package with utilities to create Make-like files in Go\n\n### Example of a make.go\n\n\tpackage main\n\n\timport (\n\t\t\"flag\"\n\t\t. \"github.com/bolcom/muts\"\n\t)\n\n\tvar BuildNumber = flag.String(\"buildnumber\", \"0\", \"build sequence number\")\n\n\tfunc main() {\n\t\tflag.Parse()\n\n\t\tTask(\"clean\", taskClean)\n\t\tTask(\"readme\", func() { Call(\"cp -v readme.md ./target/\") } )\n\t\tTask(\"build\", taskBuild)\n\n\t\tRunTasksFromArgs()\n\t}\n\n\tfunc taskClean() {\n\t\tCall(\"rm -rf target\")\n\t}\n\tfunc taskBuild() { ... }\n\nUse\tit like this\n\n\tgo run make.go -buildnumber=42 build\n\n\n## Some background\n\nThis package contains a collection of small helper functions to create scripts the easy way.\nMost of the time, shell scripting is fine but soon it can become complex once you need functions,loops and decision trees.\nSo why not use the Go language and its rich SDK to write real programs which can be organized much easier.\n\nIt all started with the Call function that mimics what you would write in a shell script.\nIt can be used both with a single line command and one that is composed of a list of strings.\nThe CallBackground version lets you wait for the program to finish or return the process ID for stopping it later.\n\n\tCall(\"zip -q -r\", fmt.Sprintf(\"%s/sql/boqs-db-%s.zip\", versionDir, *DeployableVersion), \".\")\n\nNext, we added the concept of a simple task (without the dependencies).\nA task is just a no-argument function.\nBy putting these tasks in the global Tasks map, you can execute them just by passing their names to your program:\n\n\tgo run make.go clean build unit\n\nThe last feature to mention is the Workspace variable that refers to the directory in which the program was started.\nTask execution may change this directory (Chdir) so to keep things simpler, the current directory is reset after each task.\n\nMost functions will produce a log entry.\nIf an error occurs then the program exits (calling the Abort function).\n\n\n## Defer tasks\n\nYou can put tasks on a global defer list which are run just before a program exits.\nThis can be useful to stop processes that were started during the make even\nwhen tasks fail to run and ask to abort the program.\n\nE.g. you start multiple Docker containers using different tasks for a local testing environment.\nThen you run your tests but they fail and you want to abort the build.\nAll running containers must be stopped before exiting the build program.\nYou can add a task to the defer list which is run when a task is abort or when the program panics.\n\n\tDefer(\"stop-my-container\")\n\nAll deferred tasks are run as part of the call to RunTasksFromArgs.\n\n\n[Documentation on go.dev](https://pkg.go.dev/github.com/bolcom/muts)\n\n\u0026copy; 2022 bol.com","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbolcom%2Fmuts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbolcom%2Fmuts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbolcom%2Fmuts/lists"}