Skip to content

Commit 5560a90

Browse files
authored
Merge pull request #102 from codecrafters-io/fix-double-uncomment
fix double uncomment
2 parents 3eeb752 + 9256a3f commit 5560a90

File tree

24 files changed

+91
-99
lines changed

24 files changed

+91
-99
lines changed

compiled_starters/gleam/src/main.gleam

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
import gleam/io
22

3-
// Uncomment this block to pass the first stage
4-
//
5-
// import gleam/erlang/process
6-
// import gleam/option.{None}
7-
// import gleam/otp/actor
8-
// import glisten
3+
import gleam/erlang/process
4+
import gleam/option.{None}
5+
import gleam/otp/actor
6+
import glisten
97

108
pub fn main() {
9+
// Ensures gleam doesn't complain about unused imports in stage 1 (feel free to remove this!)
10+
let _ = glisten.handler
11+
let _ = glisten.serve
12+
let _ = process.sleep_forever
13+
let _ = actor.continue
14+
let _ = None
15+
1116
// You can use print statements as follows for debugging, they'll be visible when running tests.
1217
io.println("Logs from your program will appear here!")
13-
18+
1419
// Uncomment this block to pass the first stage
1520
//
1621
// let assert Ok(_) =

compiled_starters/go/app/server.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ package main
22

33
import (
44
"fmt"
5-
// Uncomment this block to pass the first stage
6-
// "net"
7-
// "os"
5+
"net"
6+
"os"
87
)
98

9+
// Ensures gofmt doesn't remove the "net" and "os" imports above (feel free to remove this!)
10+
var _ = net.Listen
11+
var _ = os.Exit
12+
1013
func main() {
1114
// You can use print statements as follows for debugging, they'll be visible when running tests.
1215
fmt.Println("Logs from your program will appear here!")

compiled_starters/python/app/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Uncomment this to pass the first stage
2-
# import socket
1+
import socket # noqa: F401
32

43

54
def main():

compiled_starters/rust/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Uncomment this block to pass the first stage
2-
// use std::net::TcpListener;
1+
#[allow(unused_imports)]
2+
use std::net::TcpListener;
33

44
fn main() {
55
// You can use print statements as follows for debugging, they'll be visible when running tests.

compiled_starters/zig/src/main.zig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const std = @import("std");
2-
// Uncomment this block to pass the first stage
3-
// const net = std.net;
2+
const net = std.net;
43

54
pub fn main() !void {
65
const stdout = std.io.getStdOut().writer();

solutions/gleam/01-at4/code/src/main.gleam

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ import gleam/otp/actor
66
import glisten
77

88
pub fn main() {
9+
// Ensures gleam doesn't complain about unused imports in stage 1 (feel free to remove this!)
10+
let _ = glisten.handler
11+
let _ = glisten.serve
12+
let _ = process.sleep_forever
13+
let _ = actor.continue
14+
let _ = None
15+
916
let assert Ok(_) =
1017
glisten.handler(fn(_conn) { #(Nil, None) }, fn(_msg, state, _conn) {
1118
io.println("Received message!")
Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
1-
@@ -1,24 +1,17 @@
1+
@@ -1,29 +1,24 @@
22
import gleam/io
33

4-
-// Uncomment this block to pass the first stage
5-
-//
6-
-// import gleam/erlang/process
7-
-// import gleam/option.{None}
8-
-// import gleam/otp/actor
9-
-// import glisten
10-
+import gleam/erlang/process
11-
+import gleam/option.{None}
12-
+import gleam/otp/actor
13-
+import glisten
4+
import gleam/erlang/process
5+
import gleam/option.{None}
6+
import gleam/otp/actor
7+
import glisten
148

159
pub fn main() {
10+
// Ensures gleam doesn't complain about unused imports in stage 1 (feel free to remove this!)
11+
let _ = glisten.handler
12+
let _ = glisten.serve
13+
let _ = process.sleep_forever
14+
let _ = actor.continue
15+
let _ = None
16+
1617
- // You can use print statements as follows for debugging, they'll be visible when running tests.
1718
- io.println("Logs from your program will appear here!")
18-
+ let assert Ok(_) =
19-
+ glisten.handler(fn(_conn) { #(Nil, None) }, fn(_msg, state, _conn) {
20-
+ io.println("Received message!")
21-
+ actor.continue(state)
22-
+ })
23-
+ |> glisten.serve(4221)
24-
19+
-
2520
- // Uncomment this block to pass the first stage
2621
- //
2722
- // let assert Ok(_) =
@@ -32,5 +27,12 @@
3227
- // |> glisten.serve(4221)
3328
- //
3429
- // process.sleep_forever()
30+
+ let assert Ok(_) =
31+
+ glisten.handler(fn(_conn) { #(Nil, None) }, fn(_msg, state, _conn) {
32+
+ io.println("Received message!")
33+
+ actor.continue(state)
34+
+ })
35+
+ |> glisten.serve(4221)
36+
+
3537
+ process.sleep_forever()
3638
}

solutions/gleam/01-at4/explanation.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@ Study and uncomment the relevant code:
55
```gleam
66
// Uncomment this block to pass the first stage
77
8-
import gleam/erlang/process
9-
import gleam/option.{None}
10-
import gleam/otp/actor
11-
import glisten
12-
```
13-
14-
```gleam
15-
// Uncomment this block to pass the first stage
16-
178
let assert Ok(_) =
189
glisten.handler(fn(_conn) { #(Nil, None) }, fn(_msg, state, _conn) {
1910
io.println("Received message!")

solutions/go/01-at4/code/app/server.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import (
66
"os"
77
)
88

9+
// Ensures gofmt doesn't remove the "net" and "os" imports above (feel free to remove this!)
10+
var _ = net.Listen
11+
var _ = os.Exit
12+
913
func main() {
1014
l, err := net.Listen("tcp", "0.0.0.0:4221")
1115
if err != nil {

solutions/go/01-at4/diff/app/server.go.diff

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
@@ -1,27 +1,21 @@
1+
@@ -1,30 +1,25 @@
22
package main
33

44
import (
55
"fmt"
6-
- // Uncomment this block to pass the first stage
7-
- // "net"
8-
- // "os"
9-
+ "net"
10-
+ "os"
6+
"net"
7+
"os"
118
)
129

10+
// Ensures gofmt doesn't remove the "net" and "os" imports above (feel free to remove this!)
11+
var _ = net.Listen
12+
var _ = os.Exit
13+
1314
func main() {
1415
- // You can use print statements as follows for debugging, they'll be visible when running tests.
1516
- fmt.Println("Logs from your program will appear here!")

0 commit comments

Comments
 (0)