github.com/windmeup/goreleaser@v1.21.95/internal/testlib/path.go (about)

     1  package testlib
     2  
     3  import (
     4  	"os"
     5  	"os/exec"
     6  	"testing"
     7  )
     8  
     9  // CheckPath skips the test if the binary is not in the PATH.
    10  func CheckPath(tb testing.TB, cmd string) {
    11  	tb.Helper()
    12  	if os.Getenv("CI") == "true" {
    13  		// never skip on CI
    14  		return
    15  	}
    16  	if _, err := exec.LookPath(cmd); err != nil {
    17  		tb.Skipf("%s not in PATH", cmd)
    18  	}
    19  }