Module genco::lang::go

source ·
Expand description

Specialization for Go code generation.

Examples

Basic example:

use genco::prelude::*;

let toks: js::Tokens = quote! {
    function foo(v) {
        return v + ", World";
    }

    foo("Hello");
};

assert_eq!(
    vec![
        "function foo(v) {",
        "    return v + \", World\";",
        "}",
        "",
        "foo(\"Hello\");",
    ],
    toks.to_file_vec()?
);

String quoting in JavaScript:

use genco::prelude::*;

let toks: go::Tokens = quote!("start π 😊 \n \x7f end");
assert_eq!("\"start \\u03c0 \\U0001f60a \\n \\x7f end\"", toks.to_string()?);

Structs

  • Config data for Go.
  • Format for Go.
  • Language specialization for Go.
  • The import of a Go type import "foo/bar".

Enums

  • A type-erased language item capable of holding any kind.

Functions

  • The import of a Go type import "foo/bar".

Type Aliases

  • Tokens container specialization for Go.