obmarg / kazan

Kubernetes API client for Elixir
https://hex.pm/packages/kazan
MIT License
140 stars 35 forks source link

Compilation error with Elixir 1.14.1 #81

Closed gabrielpedepera closed 1 year ago

gabrielpedepera commented 1 year ago

Environment

Elixir & Erlang/OTP versions (elixir --version):

Erlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]
Elixir 1.14.1 (compiled with Erlang/OTP 25)

Which version of Kazan are you using? (cat mix.lock | grep kazan):

"kazan": {:hex, :kazan, "0.11.0", "fe70a92a922f307680086ecbfda085f11193649dd84b465e488d5b82f96e7f7b", [:mix], [{:httpoison, "~> 0.10 or ~> 1.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:poison, "~> 2.0 or ~> 3.0 or ~> 4.0", [hex: :poison, repo: "hexpm", optional: false]}, {:yaml_elixir, "~> 2.0", [hex: :yaml_elixir, repo: "hexpm", optional: false]}], "hexpm", "8786019fb0af3cef1e9d2a322ce4f12d1e03740345955a15f85d39dac03a97f0"},

Current behavior

To demonstrate this behavior I created an application through the command mix new dummy_app and added kazan as a dependency. Once that I try to compile the application through the command mix compile I get the error:

== Compilation error in file lib/kazan/server/certificate_auth.ex ==
** (CompileError) lib/kazan/server/certificate_auth.ex:9: cannot define module Inspect.Kernel because it is currently being defined in lib/kazan/server/basic_auth.ex:8
    lib/kazan/server/certificate_auth.ex:9: (module)
could not compile dependency :kazan, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile kazan", update it with "mix deps.update kazan" or clean it with "mix deps.clean kazan"

Expected behavior

If I change to using Elixir 1.14.0 instead of 1.14.1 I can compile successfully.

Elixir & Erlang/OTP versions (elixir --version):

Erlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]
Elixir 1.14.0 (compiled with Erlang/OTP 25)
Generated kazan app
==> dummy_app
Compiling 1 file (.ex)
Generated dummy_app app
gabrielpedepera commented 1 year ago

I just saw that is a bug from Elixir: https://github.com/elixir-lang/elixir/issues/12186

which breaks on this implementation here:

It was already fixed and should be released on the 1.14.2 version.

But, as mentioned here by @josevalim we can also remove for: __MODULE__ and it will remain compatible.

gabrielpedepera commented 1 year ago

I sent a PR, but feel free to accept or ignore it until the elixir 1.14.2 release.

obmarg commented 1 year ago

Closed in #82