99designs / 99designs/gqlgen

Generate groups and reorders imports incorrectly

Open
#3,586 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
10.8k
Forks
1.3k
Avg merge
2d 36m
Merged PRs (30d)
26

Description

gqlgen version: v0.17.66
go version: 1.23.3

full repro: https://github.com/mdakovac/gqlgen-import-sorting/tree/main

Go lets you group imports by separating them with a newline, however when you run the `generate` command, this grouping is broken.

import statement before `generate` in `graph/schema.resolvers.go` file
```
import (
"context"
"fmt"

"github.com/rs/zerolog"

"github.com/example/gqlgen-import-sorting/graph/model"
"github.com/spf13/viper"
)
```

after `generate`
```
import (
"context"
"fmt"

"github.com/example/gqlgen-import-sorting/graph/model"
"github.com/rs/zerolog"
"github.com/spf13/viper"
)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.