https://github.com/arvancloud/go-well
Organize import section of your go source code like a breeze.
https://github.com/arvancloud/go-well
Last synced: 5 months ago
JSON representation
Organize import section of your go source code like a breeze.
- Host: GitHub
- URL: https://github.com/arvancloud/go-well
- Owner: arvancloud
- Archived: true
- Created: 2021-01-16T15:57:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-19T19:14:49.000Z (about 5 years ago)
- Last Synced: 2025-10-22T19:49:34.856Z (8 months ago)
- Language: Go
- Homepage:
- Size: 17.6 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Make your go imports ***well*** imported!
### Describing The Problem
There is a common convention when writing go applications for importing different external or builtin packages. Something like:
```go
import (
"net/url"
"strings"
someAlias "github.com/an-external-package"
"github.com/another-external-package"
)
```
This convention helps with better reading the source code and prevents from importing wrong packages by accident.
There are different tools that can make import section of your source code like this, But each one has a pitfall sort of speaking.
One of most popular one of them is `goimports` which automatically separates different imports like above sample. But it also disorganizes the import part sometimes. Something like this:
```go
import (
"net/url"
"strings"
"github.com/disorganized-external-package"
someAlias "github.com/an-external-package"
"github.com/another-external-package"
)
```
### The Solution
We made `well` cli tool with ❤️ to help you having less disorganized imports. You just need to run `well` in your project's root and you're good to go. `well` takes care of well formatting your imports in each `go` file in your project, Recursively.
### Installation
You just need to build the tool by:
`$ go build .`
### Usage
Run the built binary in your project's root:
`$ ./well`