func GoName(stageName string) string {
	parts := strings.Split(stageName, "_")
	var result bytes.Buffer
	for _, p := range parts {
		for i, r := range p {
			if i == 0 {
				result.WriteRune(unicode.ToUpper(r))
			} else if unicode.IsUpper(r) {
				result.WriteString(strings.ToLower(p[i:]))
				break
			} else {
				result.WriteString(p[i:])
				break
			}
		}
	}
	return result.String()
}
Convert mro stage and variable names into appropriate exported go names.
package main
import (
	"bytes"
	"fmt"
	"strings"
	"unicode"
	"github.com/martian-lang/martian/martian/syntax"
)
func writeStageStructs(buffer *bytes.Buffer, stage *syntax.Stage) {
	prefix := GoName(stage.Id)
	buffer.WriteString("//\n// ")
	buffer.WriteString(stage.Id)
	buffer.WriteString("\n//\n\n")
	writeStageArgs(buffer, prefix, stage)
	writeStageOuts(buffer, prefix, stage)
	if stage.Split {
		writeStageChunkDef(buffer, prefix, stage)
		fmt.Fprintf(buffer, `
type %sJoinArgs struct {
	core.JobResources
	%sArgs
}
`, stage.Id, prefix, prefix)
		writeStageChunkOuts(buffer, prefix, stage)
	}
}