mirror of
https://github.com/luxfi/opgen.git
synced 2026-10-30 15:23:29 +00:00
A reader can now see exactly what this produces without running it, and CI regenerates example/ and refuses a diff — so a change to an emitter shows up as a change to the code it emits, in the same review. The generated Go SDK is a package of this module, so the ordinary build compiles it. CI runs on lux-build with all three toolchains installed, so the compile checks have nothing left to skip. Co-authored-by: Hanzo Dev <[email protected]>
34 lines
827 B
Go
34 lines
827 B
Go
// Command fixture writes the fixture service's client surface.
|
|
//
|
|
// What it produces is committed under example/, for two reasons. A reader can
|
|
// see exactly what this generates without running anything, and CI regenerates
|
|
// it and refuses a diff — so a change to an emitter shows up as a change to the
|
|
// code it emits, in the same review.
|
|
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/luxfi/opgen"
|
|
"github.com/luxfi/opgen/internal/fixture"
|
|
)
|
|
|
|
func main() {
|
|
out := flag.String("out", "example", "the directory to write into")
|
|
flag.Parse()
|
|
|
|
r, err := opgen.Emit(fixture.App(), opgen.Options{Dir: *out})
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
os.Exit(1)
|
|
}
|
|
for _, f := range r.Files {
|
|
fmt.Println(f)
|
|
}
|
|
for _, g := range r.Gaps {
|
|
fmt.Printf("gap %s: %s (%s)\n", g.Where, g.Op, g.Why)
|
|
}
|
|
}
|