bpf2go: improve duplicate type name error message#1993
Conversation
58692e7 to
fc5f6c4
Compare
|
@wucm667 Thanks for the patch, but I don't really agree that the behaviour should be changed. Maybe the error message is a little obtuse at the moment, that could likely be improved. If there's already a variable or map k/v of type T, specifying it additionally using For example, in Cilium we use this for exporting enums to Go using a bpf2go-like tool: #define EXPORT_TYPE(type) __expand_type(type, __COUNTER__)
#define __expand_type(type, n) ___expand_type(type, n)
#define ___expand_type(type, n) type __dpexp_ ## n
...
enum identity {
UNKNOWN_ID = 0,
HOST_ID = 1,
WORLD_ID = 2,
};
EXPORT_TYPE(enum identity);I'd probably just update the error string in |
|
@ti-mo Good point — makes sense. Updated to just improve the error message as you suggested. The |
a29d1de to
ae397d6
Compare
When --type T is used for a type that is already exported via a variable or map k/v, bpf2go reports a confusing error about the type name being used multiple times. Update the error message to guide users toward the fix: remove the redundant --type flag. Fixes cilium#1638 Signed-off-by: wucm667 <stevenwucongmin@gmail.com>
ae397d6 to
a3d10db
Compare
When --type T is used for a type that is already exported via a
variable or map k/v, bpf2go reports a confusing error about the
type name being used multiple times.
Update the error message to guide users toward the fix:
remove the redundant --type flag.
Fixes #1638