Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Information Provided
-
0.9.2
-
None
-
None
-
Mac OS X 10.10.5
Description
If the name of your Thrift package has a hyphen in it, invalid Go source code will be generated. Following the instructions here:
If you rename the tutorial file to tutorial-test.thrift, the following error happens when you run thrift -r --gen go tutorial-test.thrift:
./gen-go//tutorial-stuff/calculator.go:4:17: expected ';', found '-' WARNING - Running 'gofmt -w ./gen-go//tutorial-stuff/calculator.go' failed. ./gen-go//tutorial-stuff/ttypes.go:4:17: expected ';', found '-' WARNING - Running 'gofmt -w ./gen-go//tutorial-stuff/ttypes.go' failed. ./gen-go//tutorial-stuff/constants.go:4:17: expected ';', found '-' WARNING - Running 'gofmt -w ./gen-go//tutorial-stuff/constants.go' failed.
Looking at the source code, the issue looks to be because the package name has a hyphen in it:
// Autogenerated by Thrift Compiler (1.0.0-dev) // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING package tutorial-stuff import ( "bytes" "fmt" "git.apache.org/thrift.git/lib/go/thrift" "shared" )
This has been tested on Mac OS X 10.10.5 by installing v0.9.2 as well as v1.0.0-dev (HEAD) using homebrew. Both result in the same failure.
Attachments
Issue Links
- relates to
-
THRIFT-1383 Spaces in thrift input file lead to incorrectly generated code
- Open