goish 0.20.7

Goish Rust — write Rust using Go idioms. Ports Go's standard library and syntax so Go programmers can write Rust code that reads and feels like Go.
Documentation
// Auto-generated by goishc. Review before shipping.
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(unused_mut)]
#![allow(dead_code)]

use goish::prelude::*;

// from Go package main

// import "errors" → errors (via prelude)
// import "fmt" → fmt (via prelude)
// import "strconv" → strconv (via prelude)

Struct!{ type PathTest struct {
    path, result string
} }

var!(ErrNotFound = errors::New("not found"));
Const! {
    Sunday = iota;
    Monday;
    Tuesday;
}
pub fn divide(a: int64, b: int64) -> (int64, error) {
    if b == 0 {
        return (0, errors::New("divide by zero"));
    }
    return (a / b, nil);
}

pub fn main() {
    let mut cases = slice!([]PathTest{PathTest!("a", "A"), PathTest!("b", "B")});
    for (i, c) in range!(cases) {
        Printf!("case %d: %s -> %s\n", i, c.path, c.result);
    }
    let mut nums = slice!([]int{1, 2, 3, 4, 5});
    let mut total = 0;
    for (_, n) in range!(nums) {
        total += n;
    }
    Println!("total:", total);
    let mut m = map!([string]int{"a" => 1, "b" => 2});
    for (k, v) in range!(m) {
        Println!(k, v);
    }
    let (q, err) = divide(10, 2);
    if err != nil {
        Println!("error:", err);
    } else {
        Println!("q =", q);
    }
    let (s, err) = strconv::Atoi("42");
    if err == nil {
        Println!(s);
    }
    for i in 0..3 {
        Println!(i);
    }
}