thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Can Celasun (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (THRIFT-3333) Using filenames containing chars not valid within identifiers will create uncompileable code
Date Thu, 03 Jan 2019 14:38:00 GMT

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

Can Celasun commented on THRIFT-3333:
-------------------------------------

We have many, many language specific limitations like this. As mentioned, the solution is
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
>            Priority: Minor
>
> 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
(v7.6.3#76005)

Mime
View raw message