我正在研究 Elixir,使用 Erlang 内置:httpc
函数来执行获取请求。
if {:ok, {status, header, body}} = :httpc.request(:get, {img, []}, [], []) do
# ...
end
功能运行良好。然后在运行 mix dialyzer 后,它返回错误:
:0:unknown_function
Function :httpc.request/4 does not exist.
________________________________________________________________________________
lib/vutuv/accounts.ex:301:guard_fail
Guard test:
_ :: {:ok, {_, _, _}}
===
false
can never succeed.
________________________________________________________________________________
done (warnings were emitted)
我放这行是为了告诉 Dialyzer 跳过检查该功能。
@dialyzer {:nowarn_function, get_gravatar: 2}
但是,错误仍然存在
:0:unknown_function
Function :httpc.request/4 does not exist.
________________________________________________________________________________
done (warnings were emitted)