{"id":23469066,"url":"https://github.com/al-ce/go-aoc-template","last_synced_at":"2025-04-12T22:43:01.048Z","repository":{"id":266702662,"uuid":"898851989","full_name":"al-ce/go-aoc-template","owner":"al-ce","description":"Advent of code project template for Golang","archived":false,"fork":false,"pushed_at":"2024-12-29T04:19:35.000Z","size":80,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T22:42:32.402Z","etag":null,"topics":["advent-of-code"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/al-ce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-05T06:47:45.000Z","updated_at":"2024-12-15T13:15:19.000Z","dependencies_parsed_at":"2024-12-05T17:18:49.121Z","dependency_job_id":"21d14bdf-8e60-422f-a360-9e1faa99fd20","html_url":"https://github.com/al-ce/go-aoc-template","commit_stats":null,"previous_names":["al-ce/go-aoc-template"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/al-ce%2Fgo-aoc-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/al-ce%2Fgo-aoc-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/al-ce%2Fgo-aoc-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/al-ce%2Fgo-aoc-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/al-ce","download_url":"https://codeload.github.com/al-ce/go-aoc-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248643046,"owners_count":21138353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["advent-of-code"],"created_at":"2024-12-24T14:59:04.050Z","updated_at":"2025-04-12T22:43:01.028Z","avatar_url":"https://github.com/al-ce.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Advent of Code - Go Project Template\n\nA template structure for writing your [Advent of Code](https://adventofcode.com/) puzzle solvers in Go and printing the solution to stdout.\n\n```bash\n\u003e go run . 1 1  # prints solution for day 1 part 1\n```\n\nClone the `main` branch only (so you don't get my own branches):\n\n```bash\ngit clone --single-branch --branch main https://github.com/al-ce/aoc-go-template.git\n```\n\n## Project structure\n\n```bash\n├── inputs\n│   ├── 1\n├── internal\n│   ├── helpers\n│   │   └── helpers.go\n│   └── imports\n│       └── imports.go\n└── solutions\n    ├── day01\n    │   ├── day01.go\n    │   └── test01\n    │       └── test01.go\n```\n\nDownload the input for day `N` (no leading zeros) in `inputs/` (please note that `inputs/` is in `.gitignore` so you don't commit the input data).\n\nAn example with [aocgofetch](https://github.com/al-ce/aocgofetch):\n\n```bash\n\u003e aocgofetch 2024 1 \u003e inputs/1\n```\n\nFinally, create a new git branch for the year you are solving so you'll have a clean template for next year!\n\n## Writing a test\n\nTake the example input from the daily instructions and replace the values for `lines`, `partOneAnswer`, and `partTwoAnswer` in the test template. For example, day 1 of 2024 would look like this:\n\n```go\nvar lines = strings.Split(`3   4\n4   3\n2   5\n1   3\n3   9\n3   3`, \"\\n\")\n\nvar partOneAnswer = \"11\"\nvar partTwoAnswer = \"31\"\n```\n\nAfter writing the solution, run the test:\n\n```bash\n❯ go test go-aoc-template/solutions/day1\nok      go-aoc-template/solutions/day1  0.001s\n```\n\nThis might not cover any edge cases from the actual puzzle input.\n\n## Writing your solution\n\nFill out `PartOne()` and `PartTwo()` in the day's template with each part's solution. See [solutions/day1/day1.go](solutions/day01/day01.go) for reference.\n\nHelpers can go in [internal/helpers/helpers.go](internal/helpers/helpers.go). In `main.go`, the provided `InputLines()` helper generates the lines from the input file and passes them as a string slice to `PartOne()` and `PartTwo()`.\n\n\n## justfile\n\nThis is the `justfile` I use to help my workflow.\n\n```just\nset quiet\nreleasepath := './bin/aocgosolutions'\n_dayf := \"'$(printf %02d)'\"\n\nget year day:\n    aocgofetch {{year}} {{day}} \u003e inputs/{{day}}\n\nsolve day:\n    mkdir -p bin \u0026\u0026 go build -o {{releasepath}} go-aoc-template \u0026\u0026 {{releasepath}} {{day}}\n\ntest day:\n    go run $(printf \"./solutions/day%02d/test%02d/test%02d.go\" {{day}} {{day}} {{day}})\n\nsetup day:  # Create template for a specific day (!overwrites current file!)\n    ./setup.sh {{day}}\n\neveryday:  # Create template for every day (!overwrites all files!)\n    bash -c 'for i in {1..25}; do just setup \"$i\"; done'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fal-ce%2Fgo-aoc-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fal-ce%2Fgo-aoc-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fal-ce%2Fgo-aoc-template/lists"}