#4304·gqlgen

Generating an `Any` field in go1.27 becomes `interface{}` instead of `any` in the resolver code.

Author: gannett-ggreerCreated Aug 27, 2026Updated Sep 2, 2026

This is not gqlgen's fault as running the same code under go1.26 (any) vs. go1.27 (interface{}) causes the difference. As such, this is more of an "FYI" issue.

It causes an issue because we have CI checks that the generated code is up-to-date and linter rules convert the interface{} to any in the checked-in code so the go generate in CI detects a difference.

schema.graphqls:

scalar Any

type Query {
  example: Foo
}

type Foo {
  bar: Any
}

go1.26:

$ go version
go version go1.26.7 darwin/arm64
$ go run --mod=mod github.com/99designs/[email protected] generate --verbose
Any is incompatible with map[string]string

go1.27:

$ /opt/homebrew/Cellar/go/1.27.0/bin/go version
go version go1.27.0 darwin/arm64
$ /opt/homebrew/Cellar/go/1.27.0/bin/go run --mod=mod github.com/99designs/[email protected] generate --verbose
Any is incompatible with map[string]string

Committed the output of go1.26 to a git repository and difference after running go1.27 was:

diff --git i/generated.go w/generated.go
index a3cec9d..0800297 100644
--- i/generated.go
+++ w/generated.go
@@ -50,7 +50,7 @@ type ComplexityRoot struct {
 // region    ************************** generated!.gotpl **************************
 
 type FooResolver interface {
-	Bar(ctx context.Context, obj *Foo) (any, error)
+	Bar(ctx context.Context, obj *Foo) (interface{}, error)
 }
 type QueryResolver interface {
 	Example(ctx context.Context) (*Foo, error)
diff --git i/schema.resolvers.go w/schema.resolvers.go
index f1c67d9..e08e9ba 100644
--- i/schema.resolvers.go
+++ w/schema.resolvers.go
@@ -11,7 +11,7 @@ import (
 )
 
 // Bar is the resolver for the bar field.
-func (r *fooResolver) Bar(ctx context.Context, obj *Foo) (any, error) {
+func (r *fooResolver) Bar(ctx context.Context, obj *Foo) (interface{}, error) {
 	panic(fmt.Errorf("not implemented: Bar - bar"))
 }