Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 650 Bytes

readme.md

File metadata and controls

30 lines (19 loc) · 650 Bytes

gocodegen - Go Code Generator

This package provides Go structures for constructs used in Go source code and a helper to write those constructs to .go file with valid syntax.

Usage

  1. Get the package

    go get github.com/xapi-tools/gocodegen@latest
  2. Create Go structures for intended source code and generate file

    package main
    
    import gcg "github.com/xapi-tools/gocodegen"
    
    func main() {
        gw := gcg.NewGoFileWriter()
    
        gw.ToFile("./test.go")
    }

    Check following for more comprehensive examples: