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

Detect deps that have already been invoked #346

Merged
merged 5 commits into from Jan 16, 2022

Commits on May 7, 2021

  1. Detect deps that have already been invoked

    Detect when a dependency was accidentally already invoked
    
    mg.Deps(MyDep())
    
    Normally this causes a nil pointer panic when we invoke the function
    
    Error: runtime error: invalid memory address or nil pointer dereference
    
    Now it will print the following as soon as its detected
    
    Error: A dependency of the current target was defined improperly, with parenthesis. Dependencies should be defined as mg.Deps(MyDep), not mg.Deps(MyDep())
    
    I have applied this change to checkfn so that it applies to serial and
    parallel deps.
    
    Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
    carolynvs committed May 7, 2021
    Copy the full SHA
    e5cc427 View commit details
    Browse the repository at this point in the history

Commits on Sep 27, 2021

  1. Copy the full SHA
    e1618a1 View commit details
    Browse the repository at this point in the history

Commits on Jan 10, 2022

  1. Copy the full SHA
    d9c0439 View commit details
    Browse the repository at this point in the history
  2. Fix nil checks and improve error message

    The new mg.F function is the root of the nil-pointer error that can happen
    when someone accidentally calls mg.Deps(TargetA()). I have fixed the check
    for whether a function was passed so that it won't panic and included
    the usage for mg.F in the error message.
    
    I then added a similar check, is the target a function, to
    Deps/SerialDeps/CxtSerialDeps functions so that we can give a better
    error message when it's passed a non-function. The error message
    otherwise will reference mg.F which I don't think will help point people
    to the real problem, which is how they called mg.Deps/SerialDeps.
    
    Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
    carolynvs committed Jan 10, 2022
    Copy the full SHA
    5cd247a View commit details
    Browse the repository at this point in the history

Commits on Jan 16, 2022

  1. Copy the full SHA
    8e3dd53 View commit details
    Browse the repository at this point in the history