fix: include go:build directives in generation task

This commit is contained in:
Peter 2023-08-17 17:01:50 +02:00
parent 0ed4d13b00
commit 79c7927875
Signed by: prskr
GPG key ID: C1DB5D2E8DB512F9
4 changed files with 20 additions and 7 deletions

View file

@ -1,12 +1,21 @@
task "script" "go_fmt" {
inline = [
"go fmt ${join(" ", toset([for s in vcs.staged_files : "code.icb4dc0.de/buildr/api/${dirname(s)}" if ext(s) == ".go"]))}"
]
continue_on_error = true
}
task "script" "buf_generate" { task "script" "buf_generate" {
inline = [ inline = [
"buf generate" "buf generate",
"echo -e \"//go:build !wasi\\n\\n$(cat generated/rpc/v1/executor_grpc.pb.go)\" > generated/rpc/v1/executor_grpc.pb.go"
] ]
out_dir = repo.root out_dir = repo.root
input_mapping = { input_mapping = {
"api" = "api", "rpc" = "rpc",
"buf.yaml" = "buf.yaml"
"buf.gen.yaml" = "buf.gen.yaml" "buf.gen.yaml" = "buf.gen.yaml"
"buf.work.yaml" = "buf.work.yaml" "buf.work.yaml" = "buf.work.yaml"
} }
@ -27,7 +36,6 @@ task "script" "golangci_lint" {
depends_on = [ depends_on = [
tasks.go_fmt.id, tasks.go_fmt.id,
tasks.go_generate.id,
] ]
input_mapping = { input_mapping = {

6
.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
# buildr
.buildr/bin
.buildr/out
.buildr/logs
.buildr/.vaultpw
.buildr/state.sqlite

View file

@ -8,15 +8,15 @@ managed:
- buf.build/googleapis/googleapis - buf.build/googleapis/googleapis
plugins: plugins:
- plugin: buf.build/protocolbuffers/go:v1.31.0 - plugin: buf.build/protocolbuffers/go:v1.31.0
out: ./api/generated/ out: ./generated/
opt: paths=source_relative opt: paths=source_relative
- plugin: buf.build/grpc/go:v1.3.0 - plugin: buf.build/grpc/go:v1.3.0
out: ./api/generated/ out: ./generated/
opt: opt:
- paths=source_relative - paths=source_relative
- require_unimplemented_servers=false - require_unimplemented_servers=false
- plugin: buf.build/community/planetscale-vtprotobuf:v0.4.0 - plugin: buf.build/community/planetscale-vtprotobuf:v0.4.0
out: ./api/generated/ out: ./generated/
opt: opt:
- features=marshal+unmarshal+size+pool - features=marshal+unmarshal+size+pool
- paths=source_relative - paths=source_relative

View file

@ -10,7 +10,6 @@ package rpcv1
import ( import (
context "context" context "context"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes" codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status" status "google.golang.org/grpc/status"