1
0
Fork 0

refactor(helper): update module path and function names

- move `helper` package files to root `helper` directory
- update all helper imports
- rename `GetLines` to `getLines` for consistent naming convention

🤖
This commit is contained in:
Sebastian Mark 2024-12-02 20:51:34 +01:00
parent 39f1e7ae74
commit 999a4a8fa2
6 changed files with 10 additions and 8 deletions

View file

@ -1,9 +1,10 @@
package main package main
import ( import (
"aoc2024/helper"
"fmt" "fmt"
"sort" "sort"
"aoc/helper"
) )
type list struct { type list struct {

View file

@ -1,9 +1,10 @@
package main package main
import ( import (
"aoc2024/helper"
"fmt" "fmt"
"sort" "sort"
"aoc/helper"
) )
type reports []report type reports []report

View file

@ -1,3 +0,0 @@
module aoc2024
go 1.23.3

3
go.mod Normal file
View file

@ -0,0 +1,3 @@
module aoc
go 1.23.3

View file

@ -11,7 +11,7 @@ import (
const INPUT_FILE = "input" const INPUT_FILE = "input"
func GetLines() *bufio.Scanner { func getLines() *bufio.Scanner {
wd, err := os.Getwd() wd, err := os.Getwd()
filePath := filepath.Join(wd, INPUT_FILE) filePath := filepath.Join(wd, INPUT_FILE)
@ -24,7 +24,7 @@ func GetLines() *bufio.Scanner {
} }
func ReadLinesTwoIntSlices() (list_a []int, list_b []int) { func ReadLinesTwoIntSlices() (list_a []int, list_b []int) {
scanner := GetLines() scanner := getLines()
for scanner.Scan() { for scanner.Scan() {
parts := strings.Fields(scanner.Text()) parts := strings.Fields(scanner.Text())
@ -39,7 +39,7 @@ func ReadLinesTwoIntSlices() (list_a []int, list_b []int) {
} }
func ReadLinesToIntSlices() (lines [][]int) { func ReadLinesToIntSlices() (lines [][]int) {
scanner := GetLines() scanner := getLines()
for scanner.Scan() { for scanner.Scan() {
string_line := strings.Fields(scanner.Text()) string_line := strings.Fields(scanner.Text())
int_line := make([]int, len(string_line)) int_line := make([]int, len(string_line))