purpleidea / mgmt

Next generation distributed, event-driven, parallel config management!
https://purpleidea.com/tags/mgmtconfig/
GNU General Public License v3.0
3.58k stars 311 forks source link

[LOVE] Add Makefile "tab completion" for golang tests #335

Open purpleidea opened 6 years ago

purpleidea commented 6 years ago

Intro

This is a one - four hour patch for someone who wants to play around with Make, shell, and golang tests.

The status quo

In a previous commit, mgmt contributor @aequitas has written some magnificent patches that add test name tab completion to our Makefile. This enables you to now do:

make test<TAB>

and see a list of possible results. Running one of them will run that particular test, or test group (eg: test-shell runs a group of shell tests)

The problem

We'd love to have this sort of testing available for our golang tests as well. They can be listed per-package, and per test name with this: https://golang.org/doc/go1.9#go-test-list

If you could send us a patch adding these, it would be much appreciated, and our test runners would be the longing of the town.

purpleidea commented 6 years ago

PS: This patch can get merged as soon https://github.com/purpleidea/mgmt/issues/334 is fixed, which should be any moment now. Don't let this block you, and make sure you're on golang 1.9+ for testing.

aequitas commented 6 years ago

I did a little investigation on this, probably go test -list is to slow to make this a usable feature (at least for me with Fish shell, as it doesn't do completion caching). But I'll ponder over this some more.

purpleidea commented 6 years ago

@aequitas Good point which I hadn't considered.

ghost commented 6 years ago

I was wondering if mage would be useful instead of make ?

Mage does what make does but it's 100% golang based.

It feel perfect for a reactive system because you can use it as an interpreter and you can build holang packages and reference them from the mage interpreter.

Hope this is considered. Lots of golang devs use mage and I have found it useful because it works everywhere on such things as Wi dows even with nothing but holang installed.

Sorry to highjack this issue - but I feel it's appropriate

purpleidea commented 6 years ago

@gedw99 I've heard of the project, but it's not a priority for me. GNU Make is used because it's universal, and easily available on every machine and is a good way to bootstrap the project. Quite frankly, I think the idea of each language building their own make replacement to be a bit silly. Eg: rake, pymake, mage, bsd_make, etc... The last one was a half joke! ;)

So at least for now, everything works great, so no need for a change.

ghost commented 6 years ago

sure no probs.

I should try gnu make on windows then !!

On Mon, 21 May 2018 at 00:39 James notifications@github.com wrote:

@gedw99 https://github.com/gedw99 I've heard of the project, but it's not a priority for me. GNU Make is used because it's universal, and easily available on every machine and is a good way to bootstrap the project. Quite frankly, I think the idea of each language building their own make replacement to be a bit silly. Eg: rake, pymake, mage, bsd_make, etc... The last one was a half joke! ;)

So at least for now, everything works great, so no need for a change.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/purpleidea/mgmt/issues/335#issuecomment-390518328, or mute the thread https://github.com/notifications/unsubscribe-auth/ATuCwhAuZyBmy589VNHTeUAKFQBu46kjks5t0fCmgaJpZM4SHjx0 .

purpleidea commented 6 years ago

On Tue, May 22, 2018 at 3:55 PM, gedw99 notifications@github.com wrote:

I should try gnu make on windows then !!

Let us know how it goes! See:

https://github.com/purpleidea/mgmt/blob/master/docs/faq.md#does-this-support-windows-osx-gnu-hurd

Cheers!

davidroman0O commented 1 month ago

If it's working on linux only for now it's all fine for the current version of mgmt, it will just be pleasant to have more platforms later! Having an mgmt cli that run everywhere is a super attractive thought.

purpleidea commented 1 month ago

If it's working on linux only for now it's all fine for the current version of mgmt, it will just be pleasant to have more platforms later! Having an mgmt cli that run everywhere is a super attractive thought.

@davidroman0O Patches are welcome of course, I don't have very much Windows or Mac sys admin experience, but golang handles adding alternative implementations very easily, so it's something we could consider adding more of. There are small amounts of mac and bsd things already added IIRC.