mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2024-12-28 00:19:55 +00:00
c7d07d9ba5
Copy generator.CamelCase for camel-casing names, with one change: Convert '.' in names to '_'. This removes the need for the CamelCaseSlice function which operates on a []string representing a name split along '.'s. Add protogen.Message. Reformat generated code. Add regenerate.bash, largely copied from regenerate.sh. Change-Id: Iecf0bfc43b552f53e458499a328b933b0c9c5f82 Reviewed-on: https://go-review.googlesource.com/130915 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
35 lines
917 B
Bash
Executable File
35 lines
917 B
Bash
Executable File
#!/bin/bash
|
|
# Copyright 2018 The Go Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style
|
|
# license that can be found in the LICENSE file.
|
|
|
|
set -e
|
|
|
|
# Install the working tree's protoc-gen-gen in a tempdir.
|
|
tmpdir=$(mktemp -d -t protobuf-regen.XXXXXX)
|
|
trap 'rm -rf $tmpdir' EXIT
|
|
mkdir -p $tmpdir/bin
|
|
PATH=$tmpdir/bin:$PATH
|
|
GOBIN=$tmpdir/bin go install ./cmd/protoc-gen-go
|
|
|
|
# Public imports require at least Go 1.9.
|
|
supportTypeAliases=""
|
|
if go list -f '{{context.ReleaseTags}}' runtime | grep -q go1.9; then
|
|
supportTypeAliases=1
|
|
fi
|
|
|
|
# Generate various test protos.
|
|
PROTO_DIRS=(
|
|
cmd/protoc-gen-go/testdata
|
|
)
|
|
for dir in ${PROTO_DIRS[@]}; do
|
|
for p in `find $dir -name "*.proto"`; do
|
|
if [[ $p == */import_public/* && ! $supportTypeAliases ]]; then
|
|
echo "# $p (skipped)"
|
|
continue;
|
|
fi
|
|
echo "# $p"
|
|
protoc -I$dir --go_out=paths=source_relative:$dir $p
|
|
done
|
|
done
|