Go developers are catching on to generics — survey

Go developer survey shows more than one in four are already using generics, though some are prevented by limitations of the current implementation or tools.

thumbs up positive attitude congratulations happy employees staff
Getty Images

Generics, added to the Go programming language in March, is already seeing quick adoption, although developers are running into some limitations of the initial implementation.

These findings were included in the Go Developer Survey 2022 Q2 Results, published on September 8. A large majority of survey respondents, 86%, were aware that generics had been included in the Go 1.18 release, and 26% said they already had started using generics in their Go code. More than half of the respondents, 54%, reported being open to using generics but did not yet have a specific need for them.

A smaller group, 8%, wanted to use generics but were prevented from doing so, either by a limitation in the current generics implementation (30%), or by a limitation in supporting tools like linters (26%), or by a steep learning curve or lack of documentation (12%). The blocking issues of the generics implementation cited by respondents included a lack of parameterized methods, a need for improved type inference, and a need for switching on types. Some said the generics syntax felt awkward to use.

Described as the most significant change to the Go language since its 2012 debut, generics give developer a way to write code that is independent of the specific types being used. Generics can provide building blocks to share and reuse code and make it easier to build programs.

The Go Developer Survey 2022 Q2 was conducted in June and factored in 5,752 responses. In other findings:

  • Overall satisfaction with Go remains very high, with 93% of respondents saying they were very satisfied (63%) or somewhat satisfied (30%). Only 4% reported being dissatisfied.
  • Fuzzing, a type of automated testing that continuously manipulates inputs to locate bugs, is new to most Go developers. Awareness of Go’s built-in fuzz testing among respondents was much lower than awareness of generics.
  • Error-handling remains a challenge. This issue moved to the top of the list of Go challenges following the release of generics.
  • Third-party dependencies are a top security concern.

Go 1.18 was followed up by the release of Go 1.19 in August. It improved generic code performance and introduced an enhanced memory model.

Copyright © 2022 IDG Communications, Inc.