Hello there!
I have two modules defined in different files, one is using the struct defined in the other, as the following code explains:
# ./lib/identicon.ex
defmodule Identicon do
def hash_input(input) do
hex = :crypto.hash(:md5, input)
|> :binary.bin_to_list()
# I'm getting the error in the line below
%Identicon.Image{hex: hex}
end
end
# ./lib/image.ex
defmodule Identicon.Image do
defstruct hex: nil, color: nil, grid: nil, pixel_map: nil
end
The exact error I get from elixirlinter is the following:
Error: Identicon.Image.__struct__/0 is undefined, cannot expand struct Identicon.Image
The application is running perfectly when executed using iex -S mix.
It seems that I can't load external dependencies for the current file. My question is how to do that? Is there any better approach?
Thanks in advance!
Hello there!
I have two modules defined in different files, one is using the struct defined in the other, as the following code explains:
The exact error I get from
elixirlinteris the following:Error: Identicon.Image.__struct__/0 is undefined, cannot expand struct Identicon.ImageThe application is running perfectly when executed using
iex -S mix.It seems that I can't load external dependencies for the current file. My question is how to do that? Is there any better approach?
Thanks in advance!