-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathmain.go.diff
40 lines (37 loc) · 961 Bytes
/
main.go.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
@@ -1,29 +1,24 @@
package main
import (
"fmt"
"net"
"os"
)
// Ensures gofmt doesn't remove the "net" and "os" imports in stage 1 (feel free to remove this!)
var _ = net.Listen
var _ = os.Exit
func main() {
- // You can use print statements as follows for debugging, they'll be visible when running tests.
- fmt.Println("Logs from your program will appear here!")
-
- // Uncomment this block to pass the first stage
- //
- // l, err := net.Listen("tcp", "0.0.0.0:6379")
- // if err != nil {
- // fmt.Println("Failed to bind to port 6379")
- // os.Exit(1)
- // }
- // _, err = l.Accept()
- // if err != nil {
- // fmt.Println("Error accepting connection: ", err.Error())
- // os.Exit(1)
- // }
+ l, err := net.Listen("tcp", "0.0.0.0:6379")
+ if err != nil {
+ fmt.Println("Failed to bind to port 6379")
+ os.Exit(1)
+ }
+ _, err = l.Accept()
+ if err != nil {
+ fmt.Println("Error accepting connection: ", err.Error())
+ os.Exit(1)
+ }
}