protocolbuffers / txtpbfmt Goto Github PK
View Code? Open in Web Editor NEWtxtpbfmt parses, edits and formats text proto files in a way that preserves comments.
License: Apache License 2.0
txtpbfmt parses, edits and formats text proto files in a way that preserves comments.
License: Apache License 2.0
It would be nice to be able to run textpbfmt on files in CI to check that they're properly formatted. google-java-format
exposes this use-case through two options for example:
--dry-run, -n
Prints the paths of the files whose contents would change if the formatter were run normally.
--set-exit-if-changed
Return exit code 1 if there are any formatting changes.
I got the error below when running go get -u github.com/protocolbuffers/txtpbfmt/cmd/txtpbfmt
parser/parser.go:1346:12: undefined: math.MaxInt
Support bracket notation for repeated messages "[{}]".
Example:
$ echo "value: [{}]" | fmt
parser.Format for path <stdin> with content "value: [{}]\n" returned err
[{}] notation not supported
Full error: parser failed to make progress at index 8
position {Byte:8 Line:1 Column:9}
before: "value: ["
after: "{}]"
before+after: "value: [{}]"
1 error(s) encountered during execution
The parser imports https://github.com/golang/glog directly, for calls such as:
Line 392 in fc78c76
Line 989 in fc78c76
It's understandable to want to have some verbose logging, but I think it's a bad idea for a "pure" Go library such as a parser to make direct calls to a logging library:
glog
as part of their build and binary, even if they don't want nor need any logging.I think the best and simplest API fix would be to declare a logging interface and use it, such as:
type Logger interface {
Infof(format string, args ...interface{}) // used for verbose logs
Errorf(format string, args ...interface{})
}
One could also argue that error logs should be returned as error values instead, but I'm not very familiar with how the glog API is designed in detail.
I'm filing this because I'm the maintainer of a relatively large open source program where we use and ipmort txtpbfmt, but we pull glog indirectly too, which unfortunately affects us in multiple ways (e.g. cue-lang/cue#1199, but also binary size etc).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.