Skip to content

Releases: daixiang0/gci

v0.4.1

11 Jul 06:52
a0b03a1
Compare
Choose a tag to compare

Revert the default ordering, now GCI still makes imports order as below:

  • standard
  • default
  • custom

v0.4.0

08 Jul 11:22
856d805
Compare
Choose a tag to compare

What's Changed

  • refactor parse with AST
  • simplify section logic
  • desperate rarely used flags
  • all configs are not case sensitive
  • support skip generated files

Breaking Changes

  • the priority of the section is standard>custom>default
  • all import blocks use one TAB(\t) as Indent

Please check README to get more details.

v0.3.4

30 May 08:16
bf921fe
Compare
Choose a tag to compare

What's Changed

  • Update codes and re-enable in golangci-lint by @daixiang0 in #64

Full Changelog: v0.3.3...v0.3.4

v0.3.3

18 Mar 03:27
ed2ccb1
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.3.2...v0.3.3

v0.3.2

03 Mar 05:02
ec40303
Compare
Choose a tag to compare

What's Changed

  • Fix issue parsing block comments, and always retain prefix comments for cgo imports. by @charleskorn in #49

New Contributors

v0.3.1

18 Feb 00:42
76d765e
Compare
Choose a tag to compare

Fix #45

v0.3.0

29 Jan 02:00
73cde23
Compare
Choose a tag to compare

New features are coming on the occasion of the Chineses new year!

Great contribution from @ngehrsitz, thanks!

Now GCI supports three modes of operation:

$ gci print -h
Print outputs the formatted file. If you want to apply the changes to a file use write instead!

Usage:
  gci print path... [flags]

Aliases:
  print, output

Flags:
      --NoInlineComments           Drops inline comments while formatting
      --NoPrefixComments           Drops comment lines above an import statement while formatting
  -s, --Section strings            Sections define how inputs will be processed. Section names are case-insensitive and may contain parameters in (). A section can contain a Prefix and a Suffix section which is delimited by ":". These sections can be used for formatting and will only be rendered if the main section contains an entry.
                                   Comment(your text here) | CommentLine(your text here) - Prints the specified indented comment
                                   Def | Default - Contains all imports that could not be matched to another section type
                                   NL | NewLine - Prints an empty line
                                   Prefix(gitlab.com/myorg) | pkgPrefix(gitlab.com/myorg) - Groups all imports with the specified Prefix. Imports will be matched to the longest Prefix.
                                   Std | Standard - Captures all standard packages if they do not match another section
                                    (default [Standard,Default])
  -x, --SectionSeparator strings   SectionSeparators are inserted between Sections (default [NewLine])
  -h, --help                       help for print
$ gci write -h
Write modifies the specified files in-place

Usage:
  gci write path... [flags]

Aliases:
  write, overwrite

Flags:
      --NoInlineComments           Drops inline comments while formatting
      --NoPrefixComments           Drops comment lines above an import statement while formatting
  -s, --Section strings            Sections define how inputs will be processed. Section names are case-insensitive and may contain parameters in (). A section can contain a Prefix and a Suffix section which is delimited by ":". These sections can be used for formatting and will only be rendered if the main section contains an entry.
                                   Comment(your text here) | CommentLine(your text here) - Prints the specified indented comment
                                   Def | Default - Contains all imports that could not be matched to another section type
                                   NL | NewLine - Prints an empty line
                                   Prefix(gitlab.com/myorg) | pkgPrefix(gitlab.com/myorg) - Groups all imports with the specified Prefix. Imports will be matched to the longest Prefix.
                                   Std | Standard - Captures all standard packages if they do not match another section
                                    (default [Standard,Default])
  -x, --SectionSeparator strings   SectionSeparators are inserted between Sections (default [NewLine])
  -h, --help                       help for write
$ gci diff -h
Diff prints a patch in the style of the diff tool that contains the required changes to the file to make it adhere to the specified formatting.

Usage:
  gci diff path... [flags]

Flags:
      --NoInlineComments           Drops inline comments while formatting
      --NoPrefixComments           Drops comment lines above an import statement while formatting
  -s, --Section strings            Sections define how inputs will be processed. Section names are case-insensitive and may contain parameters in (). A section can contain a Prefix and a Suffix section which is delimited by ":". These sections can be used for formatting and will only be rendered if the main section contains an entry.
                                   Comment(your text here) | CommentLine(your text here) - Prints the specified indented comment
                                   Def | Default - Contains all imports that could not be matched to another section type
                                   NL | NewLine - Prints an empty line
                                   Prefix(gitlab.com/myorg) | pkgPrefix(gitlab.com/myorg) - Groups all imports with the specified Prefix. Imports will be matched to the longest Prefix.
                                   Std | Standard - Captures all standard packages if they do not match another section
                                    (default [Standard,Default])
  -x, --SectionSeparator strings   SectionSeparators are inserted between Sections (default [NewLine])
  -d, --debug                      Enables debug output from the formatter
  -h, --help                       help for diff

Support for the old CLI style is still present if you do not specify the subcommands. The only difference is that --local requires two dashes now.

v0.2.9

24 Jun 02:17
59beec6
Compare
Choose a tag to compare

New feature:

  • Allow a comma-separated list of local prefixes, like goimports(#33)

Fix:

v0.2.8

11 Jan 01:33
7eb50f3
Compare
Choose a tag to compare

Fix #24

v0.2.7

09 Dec 06:57
8f975be
Compare
Choose a tag to compare

Fixes #23