0.3.0 • Published 7 years ago

osh-code-go v0.3.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

osh-code-go provides a set of basic components for generating Go program code.

osh-code preset

interface GOCodeOptions {
  readonly removeComments: boolean;
}
function goCode(options: Partial<GOCodeOptions> | undefined, children: TChildren): ComponentNode<GOCodeProps>;
import { renderToString } from "osh";
import { line, docComment } from "osh-code";
import { goCode } from "osh-code-go";

renderToString(goCode(
  undefined,
  [
    docComment(
      line("Doc comment"),
    ),
    line(`func main() {`),
    indent(line(`fmt.Printf("Hello Go")`)),
    line(`}`),
  ],
));