File tree 2 files changed +13
-6
lines changed
2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -9,16 +9,17 @@ cd "$YEAR/$DAY" || exit
9
9
10
10
if [ ! -f main1.go ]; then cp ../../go.template main1.go; fi
11
11
if [ ! -f main2.go ]; then cp ../../go.template main2.go; fi
12
+ if [ ! -f common.go ]; then echo " package main" > common.go; fi
12
13
13
14
if [ ! -f Makefile ]; then cat > Makefile << EOF
14
15
input:
15
16
http "https://adventofcode.com/$YEAR /day/$DAY /input" "Cookie:session=\$ {AOC_SESSION};" >input
16
17
17
18
main1:
18
- go build -o main1 main1.go
19
+ go build -o main1 main1.go common.go
19
20
20
21
main2:
21
- go build -o main2 main2.go
22
+ go build -o main2 main2.go common.go
22
23
23
24
.PHONY: run1 run2 clean
24
25
Original file line number Diff line number Diff line change @@ -7,12 +7,18 @@ import (
7
7
)
8
8
9
9
func main() {
10
- scanner := bufio.NewScanner(os.Stdin)
10
+ x := parseInput
11
+
12
+ fmt.Println(x)
13
+ }
11
14
15
+ func parseInput() []int {
16
+ var list []int
17
+ scanner := bufio.NewScanner(os.Stdin)
12
18
for scanner.Scan() {
13
19
line := scanner.Text()
14
20
21
+ list = append(list, line)
15
22
}
16
-
17
- fmt.Println()
18
- }
23
+ return list
24
+ }
You can’t perform that action at this time.
0 commit comments