From a3d10db31a3c2e06903ba9c425ef19ca60148818 Mon Sep 17 00:00:00 2001 From: wucm667 Date: Thu, 7 May 2026 20:42:43 +0800 Subject: [PATCH] fix(bpf2go): improve duplicate type name error message 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 Signed-off-by: wucm667 --- cmd/bpf2go/gen/output.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/bpf2go/gen/output.go b/cmd/bpf2go/gen/output.go index 56ab312c7..666859895 100644 --- a/cmd/bpf2go/gen/output.go +++ b/cmd/bpf2go/gen/output.go @@ -221,7 +221,7 @@ func sortTypes(typeNames map[btf.Type]string) ([]btf.Type, error) { } if names[i] == name { - return nil, fmt.Errorf("type name %q is used multiple times", name) + return nil, fmt.Errorf("type name %q is used multiple times (remove its --type flag?)", name) } types = append(types[:i], append([]btf.Type{typ}, types[i:]...)...)