Hello 

Please some advice if something like the following could be helpful and if 
it is possible to implement with the compiler.

Thank You

func Experimental(src, dst string) error {

    //goto is blocked with err == nil
    goto r, err := os.Open(src)
    defer r.Close()
    goto w, err := os.Create(dst)
    goto v, err := io.Copy(w, r)
    goto err := w.Close()
    return nil

    //alternative
    goto err {
    r, err := os.Open(src)
    defer r.Close()
    w, err := os.Create(dst)
    v, err := io.Copy(w, r)
    err := w.Close()
    return nil
    }

    return err:
        w.Close()
        os.Remove(dst)
        fmt.Errorf("copy %s %s: %v", src, dst, err)

}

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9170f469-6858-4ff1-b70e-efc210cc1b82n%40googlegroups.com.

Reply via email to