github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/util/testhelpers/pluginbuilder/plugin_builder.go (about) 1 package pluginbuilder 2 3 import ( 4 "os" 5 "os/exec" 6 "path/filepath" 7 ) 8 9 func BuildTestBinary(relativePathToPluginDir, pluginFileName string) { 10 dir, err := os.Getwd() 11 if err != nil { 12 panic(err) 13 } 14 15 binaryDestination := filepath.Join(dir, relativePathToPluginDir, pluginFileName+".exe") 16 pluginSourceFile := filepath.Join(dir, relativePathToPluginDir, pluginFileName+".go") 17 18 cmd := exec.Command("go", "build", "-o", binaryDestination, pluginSourceFile) 19 err = cmd.Run() 20 if err != nil { 21 panic(err) 22 } 23 }