{"id":17988537,"url":"https://github.com/heyvito/go-oif","last_synced_at":"2025-06-15T20:09:50.102Z","repository":{"id":57549306,"uuid":"306114400","full_name":"heyvito/go-oif","owner":"heyvito","description":"Opinionated Imports Formatter for Golang","archived":false,"fork":false,"pushed_at":"2023-09-12T19:25:45.000Z","size":57,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-06-20T11:15:01.857Z","etag":null,"topics":["code-style","formatter","golang","import"],"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/heyvito.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-21T18:32:03.000Z","updated_at":"2024-06-18T19:46:55.000Z","dependencies_parsed_at":"2024-06-20T10:23:00.420Z","dependency_job_id":"803307a6-db3f-4b26-b218-36de749cd1ca","html_url":"https://github.com/heyvito/go-oif","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyvito%2Fgo-oif","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyvito%2Fgo-oif/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyvito%2Fgo-oif/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyvito%2Fgo-oif/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heyvito","download_url":"https://codeload.github.com/heyvito/go-oif/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222099753,"owners_count":16931479,"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":["code-style","formatter","golang","import"],"created_at":"2024-10-29T19:11:57.379Z","updated_at":"2024-10-29T19:11:57.455Z","avatar_url":"https://github.com/heyvito.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-oif\n\u003e Opinionated Imports Formatter\n\n**go-oif** is an opinionated imports formatter which sorts imports into three\ncategories:\n\n1. Built-in imports (`os`, `io`, `net/http`, etc)\n2. Third-party imports (all your dependencies)\n3. Project dependencies\n\n## Install\n\nRun the following to automatically download and install the latest version\nto `$(go env GOPATH)/bin/go-oif`\n\n```\ncurl -sSfL https://raw.githubusercontent.com/heyvito/go-oif/main/install.sh | sh -s -- -b $(go env GOPATH)/bin\n```\n\n## Usage\nThis tool attempts to guess the project name (in order to detect local\ndependencies) using data from `go.mod`. In case your project does not use\nit, please suppply the project base name through the `--project-name` (`-n`)\nflag. For instance:\n\n### Using go.mod\nConsider a project with the following go.mod file:\n```go.mod\nmodule github.com/heyvito/go-foo\n\ngo 1.17\n\n// ...\n```\n\nAnd the following imports in an arbitrary file:\n\n```go\npackage main\n\nimport \"io\"\n\nimport (\n    \"github.com/heyvito/go-foo/importc\"\n    \"net\"\n    \"github.com/heyvito/go-foo/importb\"\n    \"github.com/heyvito/go-foo/importj\"\n    \"os\"\n    ig \"github.com/heyvito/go-foo/importg\"\n    ni \"github.com/heyvito/go-foo/namedimport\"\n    _ \"github.com/lib/side_effects_import\"\n    \"github.com/foo/barA\"\n    \"fmt\"\n    \"github.com/heyvito/go-foo/importi\"\n\n    \"github.com/heyvito/go-foo/importa\"\n    \"github.com/foo/barC\"\n    \"github.com/heyvito/go-foo/importf\"\n    \"github.com/heyvito/go-foo/importh\"\n    \"github.com/heyvito/go-foo/importk\"\n    \"github.com/foo/barB\"\n    \"github.com/heyvito/go-foo/importd\"\n    _ \"github.com/heyvito/go-foo/side-effects-import\"\n    \"context\"\n\n    annotatedImport \"github.com/foo/barB\"\n    \"github.com/foo/barD\"\n    \"log\"\n    \"github.com/heyvito/go-foo/importe\"\n)\n```\n\nRunning `go-oif ./...` would rewrite the file import's as the following:\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \"io\"\n    \"log\"\n    \"net\"\n    \"os\"\n\n    \"github.com/foo/barA\"\n    \"github.com/foo/barB\"\n    \"github.com/foo/barC\"\n    \"github.com/foo/barD\"\n    \"github.com/lib/side_effects_import\"\n\n    \"github.com/heyvito/go-foo/importa\"\n    \"github.com/heyvito/go-foo/importb\"\n    \"github.com/heyvito/go-foo/importc\"\n    \"github.com/heyvito/go-foo/importd\"\n    \"github.com/heyvito/go-foo/importe\"\n    \"github.com/heyvito/go-foo/importf\"\n    \"github.com/heyvito/go-foo/importg\"\n    \"github.com/heyvito/go-foo/importh\"\n    \"github.com/heyvito/go-foo/importi\"\n    \"github.com/heyvito/go-foo/importj\"\n    \"github.com/heyvito/go-foo/importk\"\n    \"github.com/heyvito/go-foo/namedimport\"\n    \"github.com/heyvito/go-foo/side-effects-import\"\n)\n```\n\n\n### Without go.mod\nThe same effect can be achieved without a go.mod file:\n\n```\n$ go-oif -n github.com/heyvito/go-foo ./...\n```\n\n## License\n\n```\nMIT License\n\nCopyright (c) 2020-2023 Victor \"Vito\" Gama de Oliveira\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheyvito%2Fgo-oif","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheyvito%2Fgo-oif","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheyvito%2Fgo-oif/lists"}