protobuf-go-lite

module
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2024 License: BSD-3-Clause

README

protobuf-go-lite

Go Reference Build Status

Introduction

This is a version of protobuf-go which does not use reflection.

Use it with vtprotobuf-lite to compile static code for marshaling, unmarshaling, and sizing protobuf messages.

Use it with protoc-gen-go-lite-json to compile static code for json marshaling and unmarshaling to avoid importing encoding/json and the reflect package.

This is both more efficient at runtime, generates smaller code binaries without the reflection information, and features better support for tinygo which lacks support for some reflection features.

This is a fork of the upstream project modified to not use reflection.

Protobuf

protocol buffers are a cross-platform cross-language message serialization format. Protobuf is a language for specifying the schema for structured data. This schema is compiled into language specific bindings. This project provides both a tool to generate Go code for the protocol buffer language, and also the runtime implementation to handle serialization of messages in Go.

See the protocol buffer developer guide for more information about protocol buffers themselves.

Example

See the protobuf-project template for an example of how to use this package and vtprotobuf together with protowrap to generate protobufs for your project.

This package is available at github.com/aperturerobotics/protobuf-go-lite.

Package index

Summary of the packages provided by this module:

  • compiler/protogen: Package protogen provides support for writing protoc plugins.
  • cmd/protoc-gen-go-lite: The protoc-gen-go-lite binary is a protoc plugin to generate a Go protocol buffer package.

Usage

  1. Install protoc-gen-go-lite:

    go install github.com/aperturerobotics/protobuf-go-lite/cmd/protoc-gen-go-lite@latest
    
  2. Ensure your project is already using the ProtoBuf v2 API (i.e. google.golang.org/protobuf). The vtprotobuf compiler is not compatible with APIv1 generated code.

  3. Update your protoc generator to use the new plug-in.

    for name in $(PROTO_SRC_NAMES); do \
        $(VTROOT)/bin/protoc \
        --go-lite_out=. --plugin protoc-gen-go-lite="${GOBIN}/protoc-gen-go-lite" \
        proto/$${name}.proto; \
    done
    

License

BSD-3

Directories

Path Synopsis
cmd
protoc-gen-go-lite
The protoc-gen-go-lite binary is a protoc plugin to generate Go code for both proto2 and proto3 versions of the protocol buffer language.
The protoc-gen-go-lite binary is a protoc plugin to generate Go code for both proto2 and proto3 versions of the protocol buffer language.
protoc-gen-go-lite/internal_gengo
Package internal_gengo is internal to the protobuf module.
Package internal_gengo is internal to the protobuf module.
compiler
protogen
Package protogen provides support for writing protoc plugins.
Package protogen provides support for writing protoc plugins.
internal
detrand
Package detrand provides deterministically random functionality.
Package detrand provides deterministically random functionality.
editiondefaults
Package editiondefaults contains the binary representation of the editions defaults.
Package editiondefaults contains the binary representation of the editions defaults.
editionssupport
Package editionssupport defines constants for editions that are supported.
Package editionssupport defines constants for editions that are supported.
encoding/defval
Package defval marshals and unmarshals textual forms of default values.
Package defval marshals and unmarshals textual forms of default values.
encoding/tag
Package tag marshals and unmarshals the legacy struct tags as generated by historical versions of protoc-gen-go.
Package tag marshals and unmarshals the legacy struct tags as generated by historical versions of protoc-gen-go.
encoding/text
Package text implements the text format for protocol buffers.
Package text implements the text format for protocol buffers.
errors
Package errors implements functions to manipulate errors.
Package errors implements functions to manipulate errors.
flags
Package flags provides a set of flags controlled by build tags.
Package flags provides a set of flags controlled by build tags.
genid
Package genid contains constants for declarations in descriptor.proto and the well-known types.
Package genid contains constants for declarations in descriptor.proto and the well-known types.
order
Package order provides ordered access to messages and maps.
Package order provides ordered access to messages and maps.
pragma
Package pragma provides types that can be embedded into a struct to statically enforce or prevent certain language properties.
Package pragma provides types that can be embedded into a struct to statically enforce or prevent certain language properties.
protobuild
Package protobuild constructs messages.
Package protobuild constructs messages.
set
Package set provides simple set data structures for uint64s.
Package set provides simple set data structures for uint64s.
strs
Package strs provides string manipulation functionality specific to protobuf.
Package strs provides string manipulation functionality specific to protobuf.
version
Package version records versioning information about this module.
Package version records versioning information about this module.
weakdeps
Package weakdeps exists to add weak module dependencies.
Package weakdeps exists to add weak module dependencies.
types

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL