Skip to content

Shouldn't re-run targets listed in Deps that were already run from command line #359

Open
@mgabeler-lee-6rs

Description

@mgabeler-lee-6rs

If I explicitly specify a target on the command line which is also a dependency of another target I specify on the command line, it should only run that target once.

Instead it seems it runs a target once per target on the command line

Example magefile.go:

// +build mage

package main

import (
	"fmt"

	"github.com/magefile/mage/mg"
)

func A() {
	fmt.Println("A")
}

func B() {
	fmt.Println("B(deps)")
	mg.Deps(A)
	fmt.Println("B")
}

Invocation:
mage a b

Expected:

A
B(deps)
B

Actual:

A
B(deps)
A
B

More fun:

$ mage a b b
A
B(deps)
A
B
B(deps)
B

I'd expect this to be equivalent to just running mage a b, which should be functionally equivalent to running mage b

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions