sourcehut: fix-gqlgen-trimpath: conditionalize `go generate`

These directories might not exist for all modules, so don't fail the
build if they don't.

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2024-03-29 00:36:04 +01:00
parent 8edd3e2105
commit cf845d2e56
No known key found for this signature in database
GPG Key ID: 73D5E7FDEE3DE49A
1 changed files with 4 additions and 4 deletions

View File

@ -6,8 +6,8 @@
# No need to workaround -trimpath: it's not used in goModules,
# but do download `go generate`'s dependencies nonetheless.
preBuild = ''
go generate ./loaders
go generate ./graph
if [ -d ./loaders ]; then go generate ./loaders; fi
if [ -d ./graph ]; then go generate ./graph; fi
'';
});
@ -25,8 +25,8 @@
# If it fails, the gqlgenVersion may have to be updated.
preBuild = ''
unzip ''${GOPROXY#"file://"}/github.com/99designs/gqlgen/@v/v${gqlgenVersion}.zip
go generate ./loaders
go generate ./graph
if [ -d ./loaders ]; then go generate ./loaders; fi
if [ -d ./graph ]; then go generate ./graph; fi
rm -rf github.com
'';
}