TanklesXL / gladvent

A Gleam framework for running Advent of Code solutions
https://hex.pm/packages/gladvent
Apache License 2.0
27 stars 1 forks source link

Module not found issues #11

Closed mainrs closed 3 months ago

mainrs commented 3 months ago

Hello, I am new to Gleam!

I tried to use this package but I cannot get it to work properly. My code is available at https://github.com/mainrs/advent-of-code.

advent-of-code on  main 
❯ gleam run -m gladvent run 1 2 --year=2023  
   Compiled in 0.03s
    Running gladvent.main
error: Failed to run 2023 day 1

cause:
  0: failed to get runner
  1: module aoc_2023/day_1 not found

error: Failed to run 2023 day 2

cause:
  0: failed to get runner
  1: module aoc_2023/day_2 not found

I don't really understand what I am doing wrong tbh....

TanklesXL commented 3 months ago

hi there!

First off, thanks for using gladvent!

You aren't doing anything wrong as far as i could tell. Your code actually works properly, and I was able to run it (i've dropped a copy of the output below)!

What is happening is due to a bug with the existing gleam export package-interface command that gladvent has used as of v0.7.0

You have 2 options here:

1) downgrade to gladvent version v0.6.2 (gladvent = "0.6.2" in your gleam.toml) which has all the same functionality exept does not use gleam export package-interface (the downside being you don't get your functions type-checked by gladvent.

2) in between each time you call gleam run, call gleam clean or delete the gleam build cache with the following (from the root of the repo)

rm -r build/prod/erlang build/dev/erlang

Here is the output from running gleam run -m gladvent run --year=2023 1 2 3

   Compiled in 5.49s
    Running gladvent.main
Ran 2023 day 1:
  Part 1: Ok(12402)
  Part 2: error: todo - part 2 not implemented in module aoc_2023/day_1 in function pt_2 at line 23

Ran 2023 day 2:
  Part 1: error: todo - part 1 not implemented in module aoc_2023/day_2 in function pt_1 at line 2
  Part 2: error: todo - part 2 not implemented in module aoc_2023/day_2 in function pt_2 at line 6

Ran 2023 day 3:
  Part 1: error: todo - part 1 not implemented in module aoc_2023/day_3 in function pt_1 at line 2
  Part 2: error: todo - part 2 not implemented in module aoc_2023/day_3 in function pt_2 at line 6
TanklesXL commented 3 months ago

@mainrs I've actually just published gladvent v0.7.2 which should fix this, please run gleam update to fetch the latest version and give it a shot 😄

mainrs commented 3 months ago

It works now, thanks!