From 999a4a8fa2b1234a05cc051a2c02ce7af110a5bf Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Mon, 2 Dec 2024 20:51:34 +0100 Subject: [PATCH] refactor(helper): update module path and function names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - move `helper` package files to root `helper` directory - update all helper imports - rename `GetLines` to `getLines` for consistent naming convention 🤖 --- 2024/01/main.go | 3 ++- 2024/02/main.go | 3 ++- 2024/go.mod | 3 --- go.mod | 3 +++ {2024/helper => helper}/input.go | 6 +++--- {2024/helper => helper}/math.go | 0 6 files changed, 10 insertions(+), 8 deletions(-) delete mode 100644 2024/go.mod create mode 100644 go.mod rename {2024/helper => helper}/input.go (91%) rename {2024/helper => helper}/math.go (100%) diff --git a/2024/01/main.go b/2024/01/main.go index baddb7b..e933f2d 100644 --- a/2024/01/main.go +++ b/2024/01/main.go @@ -1,9 +1,10 @@ package main import ( - "aoc2024/helper" "fmt" "sort" + + "aoc/helper" ) type list struct { diff --git a/2024/02/main.go b/2024/02/main.go index ae2a1f8..adcaa28 100644 --- a/2024/02/main.go +++ b/2024/02/main.go @@ -1,9 +1,10 @@ package main import ( - "aoc2024/helper" "fmt" "sort" + + "aoc/helper" ) type reports []report diff --git a/2024/go.mod b/2024/go.mod deleted file mode 100644 index 26cc35c..0000000 --- a/2024/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module aoc2024 - -go 1.23.3 diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..5904fa3 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module aoc + +go 1.23.3 diff --git a/2024/helper/input.go b/helper/input.go similarity index 91% rename from 2024/helper/input.go rename to helper/input.go index fe70669..43ec37c 100644 --- a/2024/helper/input.go +++ b/helper/input.go @@ -11,7 +11,7 @@ import ( const INPUT_FILE = "input" -func GetLines() *bufio.Scanner { +func getLines() *bufio.Scanner { wd, err := os.Getwd() filePath := filepath.Join(wd, INPUT_FILE) @@ -24,7 +24,7 @@ func GetLines() *bufio.Scanner { } func ReadLinesTwoIntSlices() (list_a []int, list_b []int) { - scanner := GetLines() + scanner := getLines() for scanner.Scan() { parts := strings.Fields(scanner.Text()) @@ -39,7 +39,7 @@ func ReadLinesTwoIntSlices() (list_a []int, list_b []int) { } func ReadLinesToIntSlices() (lines [][]int) { - scanner := GetLines() + scanner := getLines() for scanner.Scan() { string_line := strings.Fields(scanner.Text()) int_line := make([]int, len(string_line)) diff --git a/2024/helper/math.go b/helper/math.go similarity index 100% rename from 2024/helper/math.go rename to helper/math.go