Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: an error occurred while trying to parse imports: Found non-letter character '.' in Alias: . #44

Closed
matheusalcantarazup opened this issue Feb 1, 2022 · 0 comments · Fixed by #45

Comments

@matheusalcantarazup
Copy link
Contributor

When gci try to analyze a file that use dot imports, an error is occurred.

Consider the following file:

package main

import (
	. "fmt"
)

func main() {
	Println("test")
}

When running using the following command:
gci --write --local . testdata main.go

This error is returned:

Using the old parameters is deprecated, please use the named subcommands!
2022/02/01 09:05:07 Loaded File: main.go
Error: an error occured while trying to parse imports: Found non-letter character '.' in Alias: .
Usage:
  gci [-diff | -write] [-local localPackageURLs] path... [flags]
  gci [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  diff        Prints a git style diff to STDOUT
  help        Help about any command
  print       Outputs the formatted file to STDOUT
  write       Formats the specified files in-place

Flags:
  -d, --diff            display diffs instead of rewriting files
  -h, --help            help for gci
  -l, --local strings   put imports beginning with this string after 3rd-party packages, separate imports by comma
  -v, --version         version for gci
  -w, --write           write result to (source) file instead of stdout

Use "gci [command] --help" for more information about a command.

I'm using the latest version:

$ gci --version
gci version 0.3

Using the previous version 0.2.9 the analysis finish wit successfull:

$ go install github.com/daixiang0/gci@v0.2.9
$ gci -w -local . testdata main.go
matheusalcantarazup pushed a commit to matheusalcantarazup/gci that referenced this issue Feb 1, 2022
matheusalcantarazup added a commit to matheusalcantarazup/gci that referenced this issue Feb 1, 2022
matheusalcantarazup added a commit to matheusalcantarazup/gci that referenced this issue Feb 1, 2022
Fixes daixiang0#44

Signed-off-by: Matheus Alcantara <matheus.alcantara@zup.com.br>
matheusalcantarazup added a commit to ZupIT/horusec that referenced this issue Feb 2, 2022
The latest release of gci formatter come with a bug[1] that generate an
error to format files that use dot imports. This commit fix the previous
version to avoid errors on make format until the bug is fixed.

[1] daixiang0/gci#44

Signed-off-by: Matheus Alcantara <matheus.alcantara@zup.com.br>
matheusalcantarazup added a commit to ZupIT/horusec that referenced this issue Feb 2, 2022
The latest release of gci formatter come with a bug[1] that generate an
error to format files that use dot imports. This commit fix the previous
version to avoid errors on make format until the bug is fixed.

[1] daixiang0/gci#44

Signed-off-by: Matheus Alcantara <matheus.alcantara@zup.com.br>
matheusalcantarazup added a commit to matheusalcantarazup/gci that referenced this issue Feb 7, 2022
Fixes daixiang0#44

Signed-off-by: Matheus Alcantara <matheus.alcantara@zup.com.br>
daixiang0 pushed a commit that referenced this issue Feb 8, 2022
Fixes #44

Signed-off-by: Matheus Alcantara <matheus.alcantara@zup.com.br>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant