Gccgo, Go 1.18 & generics

I have a Go project that compiles successfully with Go 1.22, but when I attempt to compile it with GCCGO, I encounter errors. The problem seems to be related to the use of generics.

Here’s a simplified example that fails to compile with GCCGO on Go 1.18:

package main

import (

type Keyring[T any] struct {
    ServiceName		T

func New[T any](serviceName T) *Keyring[T] {
    return &Keyring[T]{ ServiceName: serviceName }

func main() {

    kr := New("example.com")

I understand that generics were introduced in Go 1.18, so this code should theoretically compile.

Additionally, I’m experiencing an issue in VSCode where imports for built-in packages like fmt and encoding are not recognized, even though the project compiles without errors.

Has anyone else encountered similar issues when compiling with GCCGO and using generics? Any suggestions on how to resolve these compilation and VSCode import recognition problems would be greatly appreciated.

No generics with GCC:

The GCC 12 and 13 releases include a complete implementation of the Go 1.18 standard library. However, GCC does not yet include support for generics.