starcgen

command
v2.23.0-RC2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

starcgen is a tool to generate specialized type assertion shims to be used in Apache Beam Go SDK pipelines instead of the default reflection shim. This is done through static analysis of go sources for the package in question.

The generated type assertion shims have much better performance than the default reflection based shims used by beam. Reflection is convenient for development, but is an unnecessary expense on pipeline performance.

Using This Tool

This tool is intended for use with `go generate`. The recommended convention putting the types and functions used in a separate package from pipeline construction. Then, the tool can be used as follows:

//go:generate go install github.com/apache/beam/sdks/go/cmd/starcgen
//go:generate starcgen --package=<mypackagename>
//go:generate go fmt

This will generate registrations and shim types for all types and functions in the package, in a file `<mypackagename>.shims.go`.

Alternatively, it's possible to specify the specific input files and identifiers within the package for generation.

//go:generate go install github.com/apache/beam/sdks/go/cmd/starcgen
//go:generate starcgen --package=<mypackagename> --inputs=foo.go --identifiers=myFn,myStructFn --output=custom.shims.go
//go:generate go fmt

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL