Skip to content

Commit

Permalink
Add gem 3 first example
Browse files Browse the repository at this point in the history
  • Loading branch information
mcaci authored Jun 10, 2024
1 parent 9acf1d2 commit 38b732c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion slides.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,14 @@ transition: fade-out

# Gem #3

How to manage efficiently slices and maps operations witht the use of the generic functions in the slices and maps packages;
How to manage efficiently slices and maps operations with the use of the generic functions in the slices and maps packages;

I have been working in an application that works as a proxy server between client sending http requests, manipulates them and forwards them to the intended target. And one of the main job was to manipate an `http.Header` which in Go is simply a `map[string][]string`.

```go
func update(h html.Header, toAdd html.Header, to delete []string {}
```

Since [v1.21](https://tip.golang.org/doc/go1.21#library) we can use the maps, slices packages to do operations in maps and slices thanks to generics.

Before that you had to manipulate the code by hand
Expand Down

0 comments on commit 38b732c

Please sign in to comment.