@@ -54,13 +54,6 @@ def render(self) -> None:
5454 self .push (f'bp "{ GO_LIB_IMPORT_PATH } "' , indent = 1 )
5555 self .push (f")" )
5656
57- self .push_empty_line ()
58-
59- self .push_comment ("Avoid possible golang import not used error" )
60- self .push (f"var formatInt = strconv.FormatInt" )
61- self .push (f"var jsonMarshal = json.Marshal" )
62- self .push (f"var _ = bp.Useless" )
63-
6457
6558class BlockImportChildProto (BlockBindProto [F ]):
6659 @override (Block )
@@ -81,6 +74,15 @@ def separator(self) -> str:
8174 return "\n "
8275
8376
77+ class BlockAvoidGeneralImportsNotUsed (Block ):
78+ @override (Block )
79+ def render (self ) -> None :
80+ self .push_comment ("Avoid possible golang import not used error" )
81+ self .push (f"var formatInt = strconv.FormatInt" )
82+ self .push (f"var jsonMarshal = json.Marshal" )
83+ self .push (f"var _ = bp.Useless" )
84+
85+
8486class BlockAliasMethodBase (BlockBindAlias [F ]):
8587 @cached_property
8688 def method_receiver (self ) -> str :
@@ -750,6 +752,7 @@ def blocks(self) -> List[Block[F]]:
750752 BlockPackageName (self .bound ),
751753 BlockGeneralImports (),
752754 BlockImportChildProtoList (),
755+ BlockAvoidGeneralImportsNotUsed (),
753756 BlockBoundDefinitionList (),
754757 ]
755758
0 commit comments