File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 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
99
1010if [ ! -f main1.go ]; then cp ../../go.template main1.go; fi
1111if [ ! -f main2.go ]; then cp ../../go.template main2.go; fi
12+ if [ ! -f common.go ]; then echo " package main" > common.go; fi
1213
1314if [ ! -f Makefile ]; then cat > Makefile << EOF
1415input:
1516 http "https://adventofcode.com/$YEAR /day/$DAY /input" "Cookie:session=\$ {AOC_SESSION};" >input
1617
1718main1:
18- go build -o main1 main1.go
19+ go build -o main1 main1.go common.go
1920
2021main2:
21- go build -o main2 main2.go
22+ go build -o main2 main2.go common.go
2223
2324.PHONY: run1 run2 clean
2425
Original file line number Diff line number Diff line change @@ -7,12 +7,18 @@ import (
77)
88
99func main() {
10- scanner := bufio.NewScanner(os.Stdin)
10+ x := parseInput
11+
12+ fmt.Println(x)
13+ }
1114
15+ func parseInput() []int {
16+ var list []int
17+ scanner := bufio.NewScanner(os.Stdin)
1218 for scanner.Scan() {
1319 line := scanner.Text()
1420
21+ list = append(list, line)
1522 }
16-
17- fmt.Println()
18- }
23+ return list
24+ }
You can’t perform that action at this time.
0 commit comments