From: Dmitri Shuralyov Date: Sun, 15 May 2022 02:45:05 +0000 (-0400) Subject: cmd/compile/internal/ssa: generate code via a //go:generate directive X-Git-Tag: go1.21rc1~1883 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=47a0d467161c10f80bc3fcf7b0385b80d1194c7a;p=gostls13.git cmd/compile/internal/ssa: generate code via a //go:generate directive The standard way to generate code in a Go package is via //go:generate directives, which are invoked by the developer explicitly running: go generate import/path/of/said/package Switch to using that approach here. This way, developers don't need to learn and remember a custom way that each particular Go package may choose to implement its code generation. It also enables conveniences such as 'go generate -n' to discover how code is generated without running anything (this works on all packages that rely on //go:generate directives), being able to generate multiple packages at once and from any directory, and so on. Change-Id: I0e5b6a1edeff670a8e588befeef0c445613803c7 Reviewed-on: https://go-review.googlesource.com/c/go/+/460135 Reviewed-by: Dmitri Shuralyov Reviewed-by: Keith Randall Auto-Submit: Dmitri Shuralyov Run-TryBot: Dmitri Shuralyov TryBot-Result: Gopher Robot Reviewed-by: Keith Randall --- diff --git a/src/cmd/compile/internal/ssa/README.md b/src/cmd/compile/internal/ssa/README.md index 27ac02b4a2..5dc4fbee6f 100644 --- a/src/cmd/compile/internal/ssa/README.md +++ b/src/cmd/compile/internal/ssa/README.md @@ -214,8 +214,8 @@ To read more on rewrite rules, have a look at the top comments in Similarly, the code to manage operators is also code generated from `_gen/*Ops.go`, as it is easier to maintain a few tables than a lot of code. -After changing the rules or operators, see [_gen/README](_gen/README) for -instructions on how to generate the Go code again. +After changing the rules or operators, run `go generate cmd/compile/internal/ssa` +to generate the Go code again.