[ 
https://issues.apache.org/jira/browse/THRIFT-3333?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tim Heckman updated THRIFT-3333:
--------------------------------
    Priority: Major  (was: Critical)

> Go Thrift generator creates code with invalid package name
> ----------------------------------------------------------
>
>                 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}
> // 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