Skip to content

Commit a1d0806

Browse files
committed
Added a new module called return_a_random_greeting
1 parent 51f2c67 commit a1d0806

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

return_a_random_greeting/hello/go.mod

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module aniket-batabyal.com/hello
2+
3+
go 1.20
4+
5+
replace aniket-batabyal.com/greetings => ../greetings
6+
7+
require aniket-batabyal.com/greetings v0.0.0-00010101000000-000000000000
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"log"
6+
7+
"aniket-batabyal.com/greetings"
8+
)
9+
10+
/*
11+
12+
Learnings:
13+
14+
1. Create maps, slices (Data structures)
15+
2. run loops over slices, for loops
16+
3. Handle errors in loops
17+
18+
*/
19+
20+
func main() {
21+
22+
names := []string{
23+
"Aniket",
24+
"Animesh",
25+
"Meeta",
26+
}
27+
// message, error := greetings.GreetUser("Aniket")
28+
messages, error := greetings.GreetUsers(names)
29+
30+
if error != nil {
31+
log.Fatal(error)
32+
}
33+
34+
fmt.Println(messages)
35+
}

0 commit comments

Comments
 (0)