daixiang0 / gci

GCI, a tool that control golang package import order and make it always deterministic.
BSD 3-Clause "New" or "Revised" License
434 stars 63 forks source link

Bug: Prefix should ignore space #171

Closed sp71 closed 1 year ago

sp71 commented 1 year ago

Bug

If the prefix contains a space after the comma, it impacts the gci tool. It's common practice to use a space delimiter between commas in many applications; therefore, spaces should be ignored.

What version of GCI are you using?

0.11.1

Reproduce Steps

.golangci.yaml

linters-settings:
  gci:
    sections:
      - standard
      - default
      - prefix(github.com/company/library, github.com/company)
      - blank
      - dot
    skip-generated: true
    custom-order: true

linters:
  disable-all: true
  enable:
    - errcheck
    - gosimple
    - govet
    - ineffassign
    - staticcheck
    - unused
    - gci

run:
  issues-exit-code: 1

What did you expect to see?

Should group according to prefix ignoring space

What did you see instead?

Did not work as expected due to space. Had to remove space in prefix

      - prefix(github.com/company/library,github.com/company)