Testando o Generics do Go

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • SonarQube - Static code analysis for 29 languages.
  • Scout APM - Truly a developer’s best friend
  • talent.io - Download talent.io’s Tech Salary Report
  • lo

    💥 A Lodash-style Go library based on Go 1.18+ Generics (map, filter, contains, find...)

    package main import ( "fmt" ) func main() { s := []string{"Samuel", "Marc", "Samuel"} names := Uniq(s) fmt.Println(names) names = UniqGenerics(s) fmt.Println(names) i := []int{1, 20, 20, 10, 1} ids := UniqGenerics(i) fmt.Println(ids) } //from https://github.com/samber/lo/blob/master/slice.go func UniqGenerics[T comparable](collection []T) []T { result := make([]T, 0, len(collection)) seen := make(map[T]struct{}, len(collection)) for _, item := range collection { if _, ok := seen[item]; ok { continue } seen[item] = struct{}{} result = append(result, item) } return result } func Uniq(collection []string) []string { result := make([]string, 0, len(collection)) seen := make(map[string]struct{}, len(collection)) for _, item := range collection { if _, ok := seen[item]; ok { continue } seen[item] = struct{}{} result = append(result, item) } return result }

  • InfluxDB

    Build time-series-based applications quickly and at scale.. InfluxDB is the Time Series Data Platform where developers build real-time applications for analytics, IoT and cloud-native services in less time with less code.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts