Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad generated code -- double import section #59

Open
cespare opened this issue Dec 22, 2012 · 0 comments
Open

Bad generated code -- double import section #59

cespare opened this issue Dec 22, 2012 · 0 comments

Comments

@cespare
Copy link

cespare commented Dec 22, 2012

Maybe I'm doing something wrong, but I'm getting generated Go code that has imports in the file after some code (which is illegal). I get this with my own thrift code, but also just with the tutorial.

$ ./thrift-0.9.0/compiler/cpp/thrift -r --gen go thrift-0.9.0/tutorial/tutorial.thrift
./gen-go//tutorial/Calculator.go:23:1: expected declaration, found 'import'
WARNING - Running 'gofmt -w ./gen-go//tutorial/Calculator.go' failed.
./gen-go//tutorial/ttypes.go:23:1: expected declaration, found 'import'
WARNING - Running 'gofmt -w ./gen-go//tutorial/ttypes.go' failed.

And when we look at gen-go/tutorial/Calculator.go:

// Comments elided
package tutorial;

import (
        "fmt"
        "math"
        "thrift"
)

func init() {
        var temporaryAndUnused int32 = math.MinInt32
        temporaryAndUnused++
}

import "shared"

type ICalculator interface {
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant