Categorygithub.com/tommy-sho/grouper
repositorypackage
0.0.2
Repository: https://github.com/tommy-sho/grouper.git
Documentation: pkg.go.dev

# README

GitHub Releases
license
build status

Example

  • before
package main

import(
	"bytes"
	"errors"

	"golang.org/x/tools/go/ast/astutil"

	"fmt"
	"golang.org/x/tools/imports"
)
...
  • after grouper run...
package main

import (
        "bytes"
        "errors"
        "fmt"

        "golang.org/x/tools/go/ast/astutil"
        "golang.org/x/tools/imports"
)
  • in case of goimports...
package main

import(
        "bytes"
        "errors"

        "golang.org/x/tools/go/ast/astutil"

        "fmt"

        "golang.org/x/tools/imports"
)

Features

  • grouping/ordering import, if blank line exists before/after paths.

Usage

  • set directories or files as arguments of the command.
  • if you set the prefix to -local option, the packages which beginning with that prefix put after 3rd-party packages.
GLOBAL OPTIONS:
   --local value, -l value  specify imports prefix beginning with this string after 3rd-party packages. especially your own organization name. comma-separated list
   --write, -w              write result source to original file instead od stdout (default: false)

Install

with go command.

$  go install github.com/tommy-sho/grouper

License

MIT

Author

tommy-sho