[ 
https://issues.apache.org/jira/browse/THRIFT-3333?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14900416#comment-14900416
 ] 

Jens Geyer edited comment on THRIFT-3333 at 9/21/15 9:21 AM:
-------------------------------------------------------------

That's only one aspect of a more complex problem. The same is true with other 
illegal chars and with other languages. The recommened solution is to not doing 
this and/or providing namespaces.


was (Author: jensg):
That's only one aspect of a more complex problem. The same is true with other 
illegal chars and with other languages. The recommened solution is to not doing 
this.

> Using filenames containing chars not valid within identifiers will create 
> uncompileable code
> --------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-3333
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3333
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Compiler
>    Affects Versions: 0.9.2, 1.0
>         Environment: Mac OS X 10.10.5
>            Reporter: Tim Heckman
>
> If the name of your Thrift package has a hyphen in it, invalid Go source code 
> will be generated. Following the instructions here:
> * https://thrift.apache.org/tutorial/go
> If you rename the tutorial file to {{tutorial-test.thrift}}, the following 
> error happens when you run {{thrift -r --gen go tutorial-test.thrift}}:
> {noformat}
> ./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.
> {noformat}
> Looking at the source code, the issue looks to be because the package name 
> has a hyphen in it:
> {code:title=calculator.go|linenumbers}
> // 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"
> )
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to