Re: [go-nuts] errors (langChange)

2022-04-14 Thread Matthias Mädel
following simulates some functionality package main import ( "fmt" "io" "log" "os" ) func GOTO(f *os.File, e error) (*os.File, error) { return f, e } func COPYGOTO(i int64, e error) (int64, error) { return i, e } var err error var r, w *os.File func main() { log.Println(

Re: [go-nuts] errors (langChange)

2022-04-14 Thread Matthias Mädel
some refining... func Experimental(src, dst string) error { //goto jumps to "label" if present; selects values right to left; is ignored with value´s zero value goto r, err := os.Open(src) defer r.Close() goto w, err := os.Create(dst) defer w.Close() goto v, err := io.Cop

Re: [go-nuts] errors (langChange)

2022-04-13 Thread Ian Lance Taylor
On Wed, Apr 13, 2022 at 2:44 PM Matthias Mädel wrote: > > 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

[go-nuts] errors (langChange)

2022-04-13 Thread Matthias Mädel
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.