Go developers are catching on to generics — survey

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.

Credit: Dreamstime

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 per cent, were aware that generics had been included in the Go 1.18 release, and 26 per cent said they already had started using generics in their Go code. 

More than half of the respondents, 54 per cent, reported being open to using generics but did not yet have a specific need for them.

A smaller group, eight per cent, wanted to use generics but were prevented from doing so, either by a limitation in the current generics implementation (30 per cent), or by a limitation in supporting tools like linters (26 per cent), or by a steep learning curve or lack of documentation (12 per cent).

The blocking issues of the generics implementation cited by respondents included a lack of parameterised 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 per cent of respondents saying they were very satisfied (63 per cent) or somewhat satisfied (30 per cent). Only four per cent 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.

Meanwhile, error-handling remains a challenge. This issue moved to the top of the list of Go challenges following the release of generics. Also, 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.

Tags GooglesoftwareGo

Brand Post

Show Comments