A Practical Guide to go‑internal/testscript for Testing Command‑Line Tools

Today, I discovered an excellent testing package by Roger Peppe : go-internal/testscript . At work, I&rsquo;ve been using Bats for testing cli stuff. All of our cli stuff is almost migrated from legacy Perl-scripts to Go (using the kong cmdline parser). Bats allows you to run cli programs and check the results. It does not care about the inner workings, as long as it outputs or generates the right…