{"id":44464754,"url":"https://github.com/semk/gofiximports","last_synced_at":"2026-02-12T19:35:48.386Z","repository":{"id":57531635,"uuid":"276874286","full_name":"semk/gofiximports","owner":"semk","description":"Utility to fix/replace import paths in Go files recursively \u0026 pretty-print like gofmt","archived":false,"fork":false,"pushed_at":"2020-07-10T07:53:30.000Z","size":26,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T13:29:56.209Z","etag":null,"topics":["formatting","go","gofmt","golang","import","pretty-print"],"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/semk.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":"2020-07-03T10:35:34.000Z","updated_at":"2022-09-12T06:08:24.000Z","dependencies_parsed_at":"2022-09-06T23:11:46.758Z","dependency_job_id":null,"html_url":"https://github.com/semk/gofiximports","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/semk/gofiximports","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semk%2Fgofiximports","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semk%2Fgofiximports/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semk%2Fgofiximports/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semk%2Fgofiximports/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/semk","download_url":"https://codeload.github.com/semk/gofiximports/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semk%2Fgofiximports/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29378819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T19:05:20.189Z","status":"ssl_error","status_checked_at":"2026-02-12T19:01:44.216Z","response_time":55,"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":["formatting","go","gofmt","golang","import","pretty-print"],"created_at":"2026-02-12T19:35:48.047Z","updated_at":"2026-02-12T19:35:48.374Z","avatar_url":"https://github.com/semk.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gofiximports\nUtility to fix/replace import paths in Go files recursively \u0026 pretty-print like gofmt.\n\n## Installation\n\n```\n$ go get github.com/semk/gofiximports\n```\n\n## Usage\n\n```\nUsage of gofiximports:\n  -dir string\n    \tdirectory where the replacements are to be done (default \"./\")\n  -from string\n    \timport statement to be replaced\n  -indent int\n    \tall code is indented at least by this much\n  -rawformat\n    \tdo not use a tabwriter; if set, -usespaces is ignored\n  -recursive\n    \tpeform the replacecements recursively on the directory (to be used with -dir) (default true)\n  -sourcepos\n    \temit //line directives to preserve original source positions\n  -stdin\n    \tread the file names from stdin where the replacements are to be done (overrides -dir)\n  -tabindent\n    \tuse tabs for indentation independent of -usespaces (default true)\n  -tabwidth int\n    \ttab width (default 8)\n  -to string\n    \treplacement import statement\n  -usespaces\n    \tuse spaces instead of tabs for alignment (default true)\n```\n\n## Examples\n\nThe following example replaces all imports of `\"library/module\"` to `\"repository/library/module\"`\nrecursively inside the `awesome_go_project` directory. The command only modifies `.go` files.\n\n```\n$ gofiximports -dir awesome_go_project -from \"library/module\" -to \"repository/library/module\"\n```\n\nNOTE: The above command will replace all the imports starting with `\"library/module\"`.\n`\"library/module/x\"` will be changed to `\"repository/library/module/x\"` as well.\n\nBefore fixing imports:\n```go\npackage main\nimport logger \"fmt\"\nfunc main() {\n    logger.Println(\"hello world\")\n}\n```\n\n```\n$ gofiximports -dir test -from \"fmt\" -to \"log\"\n```\n\nAfter fixing imports:\n```go\npackage main\n\nimport logger \"log\"\n\nfunc main() {\n\tlogger.Println(\"hello world\")\n}\n\n```\n\nYou can also pass the list of files to `stdin` using pipe.\n\n```\n$ find ./test -name \"*.go\" | gofiximports -stdin -from \"fmt\" -to \"log\" \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemk%2Fgofiximports","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsemk%2Fgofiximports","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemk%2Fgofiximports/lists"}