For example, take a look at https://review.gerrithub.io/c/cue-lang/cue/+/1222171, which ran modernize -fix -slicescontains ./...
at version v0.0.0-20250905165647-bd1ee09fe80a
on the https://github.com/cue-lang/cue repo as of 20531e1837bf21fd9b38f83610d1a47d663fe2fc, and the resulting diffs add std imports in non-std import groups:
diff --git encoding/openapi/cycle.go encoding/openapi/cycle.go
index a8c6933d..436fc248 100644
--- encoding/openapi/cycle.go
+++ encoding/openapi/cycle.go
@@ -21,6 +21,7 @@ import (
"cuelang.org/go/internal/core/dep"
"cuelang.org/go/internal/core/eval"
internalvalue "cuelang.org/go/internal/value"
+ "slices"
)
Comment From: adonovan
I think was supposed to have been fixed by https://go.dev/cl/664436, but apparently more work is needed.
See also: - https://go.dev/cl/648136 - https://github.com/golang/go/issues/72035
@xieyuschen @jba
Comment From: mvdan
Ah, I think I spot the edge case; the file at master just has the imports
import (
"cuelang.org/go/cue"
"cuelang.org/go/cue/errors"
"cuelang.org/go/cue/token"
"cuelang.org/go/internal/core/dep"
"cuelang.org/go/internal/core/eval"
internalvalue "cuelang.org/go/internal/value"
)
so the logic probably needs to be tweaked such that, if the first import group isn't the standard library, a new import group at the top should be introduced.
Comment From: xieyuschen
I'll try to tackle this sometime this week. Open to anyone else picking it up as well! :)