Bad generated code -- double import section #59

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

1 participant

@cespare

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