Find "secure file erase" commands on the system
You have no synchronization for these package variables
var shredPath, shredFlag string

Therefore,
fmt.Println(shredPath, shredFlag)
go func() {
    for i := 0; i &lt; 1000; i++ {
        shredCmd()
    }
}()
for i := 0; i &lt; 1000; i++ {
    shredCmd()
}
fmt.Println(shredPath, shredFlag)

WARNING: DATA RACE
Found 3 data race(s)

os.Remove() and commands may fail if the file is open.
If you encounter something unexpected, for example Windows, you do nothing, not even os.Remove().
The if statements are ugly. Since shredCmd() is effectively a test, use the standard testing package technique, table-driven tests.
You provide no context for usage or testing, for example
func ShredFile(filename string) error {
    // ...
}

And so on.

Here's an attempt to fix some of the issues:
shred.go:
package main

import (
    &quot;errors&quot;
    &quot;fmt&quot;
    &quot;io/ioutil&quot;
    &quot;os&quot;
    &quot;os/exec&quot;
    &quot;time&quot;
)

var shredCmds = []struct {
    name, opts string
}{
    {&quot;shred&quot;, &quot;-u&quot;},
    {&quot;srm&quot;, &quot;-f&quot;},
    {&quot;rm&quot;, &quot;-Pf&quot;},
    {&quot;rm&quot;, &quot;-f&quot;},
    {&quot;sdelete&quot;, &quot;-a&quot;},
}

func shredTemp(path, opts string) error {
    file, err := ioutil.TempFile(&quot;&quot;, &quot;shredTemp.&quot;)
    if err != nil {
        return err
    }
    filename := file.Name()
    defer os.Remove(filename)
    defer file.Close()

    err = file.Close()
    if err != nil {
        return err
    }
    err = RunCmd(path, opts, filename)
    if err != nil {
        return err
    }
    return nil
}

var shredPath, shredOpts = func() (string, string) {
    for _, cmd := range shredCmds {
        path, err := exec.LookPath(cmd.name)
        if err != nil {
            continue
        }
        err = shredTemp(path, cmd.opts)
        if err == nil {
            return path, cmd.opts
        }
    }
    return &quot;&quot;, &quot;&quot;
}()

func ShredFile(filename string) error {
    fi, err := os.Stat(filename)
    if err != nil {
        return err
    }
    if !fi.Mode().IsRegular() {
        err := errors.New(&quot;filename is not mode regular&quot;)
        return err
    }

    if shredPath == &quot;&quot; {
        return os.Remove(filename)
    }

    err = RunCmd(shredPath, shredOpts, filename)
    if err != nil {
        return err
    }
    return nil
}

func RunCmd(command string, args ...string) error {
    cmd := exec.Command(command, args...)
    cmd.Stdin = os.Stdin
    cmd.Stdout = os.Stdout
    cmd.Stderr = os.Stderr
    err := cmd.Start()
    if err != nil {
        return fmt.Errorf(&quot;RunCmd cmd=%q err=%w&quot;, command, err)
    }
    err = cmd.Wait()
    if err != nil {
        return fmt.Errorf(&quot;RunCmd cmd=%q err=%w&quot;, command, err)
    }
    return nil
}

func main() {
    file, err := ioutil.TempFile(&quot;&quot;, &quot;ShredFile.&quot;)
    if err != nil {
        fmt.Println(err)
        return
    }
    filename := file.Name()
    file.Close()
    defer os.Remove(filename)
    start := time.Now()
    err = ShredFile(filename)
    since := time.Since(start)
    fmt.Println(filename, since, err)
}