Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getGoDirs and buildGoDir are undefined in check when using custom buildPhase #122

Open
niklashhh opened this issue Aug 18, 2023 · 0 comments

Comments

@niklashhh
Copy link

niklashhh commented Aug 18, 2023

Passing

  buildPhase = ''
runHook preBuild
make
runHook postBuild
  '';

to buildGoApplication causes checkPhase to error with

/nix/store/rk3g4mxrs84bv1vanqnzpdkhm73ksr0z-stdenv-linux/setup: line 1601: getGoDirs: command not found

Or if getGoDirs is defined, then the error is

/nix/store/rk3g4mxrs84bv1vanqnzpdkhm73ksr0z-stdenv-linux/setup: line 1602: buildGoDir: command not found

this happens because getGoDirs and buildGoDir are defined in the default buildPhase.

Both checkPhase and buildPhase share the same code for looping over subCommands:

          for pkg in $(getGoDirs test); do
            buildGoDir test "$pkg"
          done

In my opinion this should be refactored out and the getGoDirs and buildGoDir both be inputs to the buildGoApplication function.

I do understand that overriding buildPhase and/or checkPhase isn't exactly intended, but my use-case is to run the make command in buildPhase which isn't supported by the default buildPhase build command:

if ! OUT="$(go $cmd "''${flags[@]}" $dir 2>&1)"; then

In my case it was rather simple to write the checkPhase manually, so that is a reasonable workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant