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

Import block duplicated following import "C" #130

Closed
mdelah opened this issue Nov 24, 2022 · 1 comment · Fixed by #131
Closed

Import block duplicated following import "C" #130

mdelah opened this issue Nov 24, 2022 · 1 comment · Fixed by #131
Labels
bug Something isn't working

Comments

@mdelah
Copy link

mdelah commented Nov 24, 2022

What version of GCI are you using?

0.8.5

Reproduce Steps

With source file main.go containing import "C":

package main

import (
        "fmt"
        "math/rand"
)

import "C"

func main() {
        fmt.Println(rand.Int())
}

Run gci output main.go

What did you expect to see?

No change to source file

What did you see instead?

gci wants to insert a duplicate of the first import block:

package main

import (
        "fmt"
        "math/rand"
)

import "C"

import (
        "fmt"
        "math/rand"
)

func main() {
        fmt.Println(rand.Int())
}

I note a similar issue marked as closed. Possible regression?

@daixiang0 daixiang0 added the bug Something isn't working label Nov 25, 2022
@daixiang0
Copy link
Owner

Thanks for your report. #106 provides this feature and assumes that the C import block is always the first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants