From cbd4b6881fd0aa2324e54c1d2dcd4741f18f473d Mon Sep 17 00:00:00 2001 From: vincent Date: Sat, 26 Apr 2025 15:04:24 +0800 Subject: [PATCH 1/2] fix bitset XXChoiceValues compile issue --- .../sbe/generation/golang/struct/GolangGenerator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/struct/GolangGenerator.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/struct/GolangGenerator.java index d764a11eca..04660d9e4c 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/struct/GolangGenerator.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/struct/GolangGenerator.java @@ -1650,8 +1650,9 @@ private void generateChoiceDecls( String comma = ""; for (final Token token : tokens) { + // In Go a composite‐literal’s elements must either be untyped constants (which are assignable to any compatible numeric type) or exactly the same type as the field. So the untyped constants, such 0, 1 works fine, but if using the primite type such as uint64{0} would not works here. sb.append(comma) - .append(generateLiteral(token.encoding().primitiveType(), token.encoding().constValue().toString())); + .append(token.encoding().constValue().toString()); comma = ", "; } From ce83fb4f2a87b8757c093d60eebef53bcdcc7f53 Mon Sep 17 00:00:00 2001 From: vincent Date: Sun, 27 Apr 2025 10:17:37 +0800 Subject: [PATCH 2/2] fix the comments style --- .../sbe/generation/golang/struct/GolangGenerator.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/struct/GolangGenerator.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/struct/GolangGenerator.java index 04660d9e4c..69b9765550 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/struct/GolangGenerator.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/struct/GolangGenerator.java @@ -1650,7 +1650,10 @@ private void generateChoiceDecls( String comma = ""; for (final Token token : tokens) { - // In Go a composite‐literal’s elements must either be untyped constants (which are assignable to any compatible numeric type) or exactly the same type as the field. So the untyped constants, such 0, 1 works fine, but if using the primite type such as uint64{0} would not works here. + // In Go a composite‐literal’s elements must either be untyped constants. + // (which are assignable to any compatible numeric type) or exactly the same type as the field. + // So the untyped constants, such 0, 1 works fine, + // but if using the primite type such as uint64{0} would not works here. sb.append(comma) .append(token.encoding().constValue().toString()); comma = ", ";