+protoc-gen-go

This commit is contained in:
Jacob Heider 2024-04-26 12:00:47 -04:00 committed by Jacob Heider
parent ef4baf2db5
commit 14d255e784

View file

@ -0,0 +1,47 @@
distributable:
url: https://github.com/protocolbuffers/protobuf-go/archive/refs/tags/{{version.tag}}.tar.gz
strip-components: 1
versions:
github: protocolbuffers/protobuf-go
provides:
- bin/protoc-gen-go
companions:
protobuf.dev: '*'
build:
dependencies:
go.dev: ^1.17
script:
- go mod download
- go build -v -trimpath -ldflags="$GO_LDFLAGS" -o $BUILDLOC ./cmd/protoc-gen-go
env:
BUILDLOC: '{{prefix}}/bin/protoc-gen-go'
GO_LDFLAGS:
- -s
- -w
linux:
# or segmentation fault
# fix found here https://github.com/docker-library/protocolbuffers/issues/402#issuecomment-982204575
GO_LDFLAGS:
- -buildmode=pie
test:
dependencies:
go.dev: '*'
script:
- run: cp $FIXTURE test.proto
fixture: |
syntax = "proto3";
package test;
option go_package = "./test";
message TestCase {
string name = 4;
}
message Test {
repeated TestCase case = 1;
}
- protoc test.proto --go_out=.
- grep 'package test' test/test.pb.go