func getCurrentWorkspace() (*workspace, error) { if w, err := workspaces.GetCurrentWorkspace(); err != nil { return nil, err } else { return &workspace{*w}, nil } }
func main() { w, err := workspaces.GetCurrentWorkspace() if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } if len(os.Args) < 2 { fmt.Fprintln(os.Stderr, "Usage: wgo-exec COMMAND [ARG+]") os.Exit(1) } os.Setenv("GOPATH", w.Gopath(true)) cmd := exec.Command(os.Args[1], os.Args[2:]...) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr if err := cmd.Run(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } }