Skip to content

Commit fe98644

Browse files
Emyrkjohnstcn
andauthored
chore: ensure go file is valid during generation (#15903)
Closes coder/internal#258 --------- Co-authored-by: Cian Johnston <cian@coder.com>
1 parent 13bb449 commit fe98644

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,10 @@ examples/examples.gen.json: scripts/examplegen/main.go examples/examples.go $(sh
657657
go run ./scripts/examplegen/main.go > examples/examples.gen.json
658658

659659
coderd/rbac/object_gen.go: scripts/typegen/rbacobject.gotmpl scripts/typegen/main.go coderd/rbac/object.go coderd/rbac/policy/policy.go
660-
go run scripts/typegen/main.go rbac object > coderd/rbac/object_gen.go
660+
tempdir=$(shell mktemp -d /tmp/typegen_rbac_object.XXXXXX)
661+
go run ./scripts/typegen/main.go rbac object > "$$tempdir/object_gen.go"
662+
mv -v "$$tempdir/object_gen.go" coderd/rbac/object_gen.go
663+
rmdir -v "$$tempdir"
661664

662665
codersdk/rbacresources_gen.go: scripts/typegen/codersdk.gotmpl scripts/typegen/main.go coderd/rbac/object.go coderd/rbac/policy/policy.go
663666
# Do no overwrite codersdk/rbacresources_gen.go directly, as it would make the file empty, breaking

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy