You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@thrift.apache.org by "Jens Geyer (Jira)" <ji...@apache.org> on 2026/09/11 13:38:00 UTC
[jira] [Created] (THRIFT-6239) Go -remote tool does not compile for functions inherited from a file that is not included directly
Jens Geyer created THRIFT-6239:
----------------------------------
Summary: Go -remote tool does not compile for functions inherited from a file that is not included directly
Key: THRIFT-6239
URL: https://issues.apache.org/jira/browse/THRIFT-6239
Project: Thrift
Issue Type: Bug
Components: Go - Compiler
Affects Versions: 0.24.0
Reporter: Jens Geyer
The {{-remote}} command-line tool that the Go generator writes for a service does not compile when the service inherits functions from a service two include levels away. The tool imports only the service's own package and the packages of the files that service includes directly, and {{generate_service_remote()}} falls back to the service's own package for anything declared elsewhere.
{noformat}
// GrandC.thrift
namespace go grandc
enum Color {
RED = 1,
}
struct Pt {
1: i32 x
}
service GrandService {
void grandList(1: list<i32> zs),
void grandEnum(1: Color c),
void grandStruct(1: Pt pt),
}
// MidA.thrift
include "GrandC.thrift"
namespace go mida
service MidService extends GrandC.GrandService {
void mid(1: i32 x),
}
// LeafB.thrift
include "MidA.thrift"
namespace go leafb
service LeafService extends MidA.MidService {
void leaf(1: i32 y),
}
{noformat}
In a Go module named {{exp}}:
{noformat}
$ thrift -r -out gen --gen go:package_prefix=exp/gen/ LeafB.thrift
$ go build ./gen/leafb/leaf_service-remote
gen/leafb/leaf_service-remote/leaf_service-remote.go:197:29: undefined: leafb.NewGrandServiceGrandListArgs
gen/leafb/leaf_service-remote/leaf_service-remote.go:218:22: undefined: leafb.Color
gen/leafb/leaf_service-remote/leaf_service-remote.go:238:22: undefined: leafb.NewPt
{noformat}
All three are declared in {{grandc}}, which the tool does not import. Container, enum and struct arguments fail alike.
One level away, THRIFT-6200 fixes enum arguments. Container and exception arguments fail there as well: {{func_to_service}} (THRIFT-5002) records only the name of the service that declares an inherited function, not its package, so the args constructor is qualified with the service's own package. For a service in {{childb}} that extends one in {{parenta}}, the tool fails with {{undefined: childb.NewParentServiceTakeListArgs}}.
Reproduced with 0.24.0 and current master.
_Drafted with AI assistance (Claude Opus 5); reviewed and posted by Jens Geyer._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)