ordino

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2021 License: MIT Imports: 17 Imported by: 0

README

Ordino

This package sorts Go imports in groups and in a default or user-defined order.

Shoulders

This customized package uses a lot of the logic and some tools from goimports-reviser

Requirements

Usage

Install it by running:

go install github.com/Project-Centurion/ordino@latest
ordino -project-name [YourProjectName] -output [TheOutPutYouWant] -order [thePackagesOrderYouWant] [file/path/to/your/gofile.go]
Required arguments
  • single file sorting

file/path/to/your/gofile.go : the path from the current directory to the file where you want your imports sorted.

  • recursive run

./... : sorts imports from all the .go files under the current directory

example :

ordino -project-name [YourProjectName] ./...
Optional arguments
  • theOutPutYouWant : either file or stdout, by default file (will rewrite the files sorted).
  • thePackagesOrderYouWant : constructed like this std,alias,project,general by default, meaning the order you want between the packages, separated by commas, no spaces. Aliased packages being separated are optional.
  • YourProjectName : the imports you want sorted as project imports. Please provide the path to those imports such as github.com/MyGreatProject or github.com/MyGreatProject/mySuperGreatGoRepository. If not set, the project name will be fetched from go.mod
Real life examples:
ordino -order std,project,general -project-name github.com/Project-Centurion/ordino ./...
ordino -order project,general,std -output stdout main.go

Documentation

Overview

Ordo is a tool to sort and beautify golang code See README.md for more info.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL