Skip to content

Commit 4a2b8ba

Browse files
committed
fmt: update
1 parent 963dcce commit 4a2b8ba

File tree

4 files changed

+78
-0
lines changed

4 files changed

+78
-0
lines changed

fmt/printer.go

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fmt/printer.go2

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package fmt
2+
3+
import "fmt"
4+
5+
// Print prints the elements of a slice.
6+
// It should be possible to call this with any slice value.
7+
func Print[type T](s []T) {
8+
for _, v := range s {
9+
fmt.Println(v)
10+
}
11+
}
12+
13+
func Pirnt[type T](s ...T) {
14+
for _, v := range s {
15+
fmt.Println(v)
16+
}
17+
}

fmt/printer_test.go

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fmt/printer_test.go2

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package fmt
2+
3+
import "testing"
4+
5+
func TestPrint(t *testing.T) {
6+
Print([]int{1, 2, 3})
7+
}

0 commit comments

Comments
 (0)