codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3GetBucketLocation.java
private void writeDeserializerSwapFunction(
            GoWriter writer,
            ServiceShape service,
            OperationShape operation
    ) {
        writer.writeDocs("Helper to swap in a custom deserializer");
        writer.openBlock("func $L(stack *middleware.Stack) error{", "}",
                swapDeserializerFuncName, () -> {
                    writer.write("_, err := stack.Deserialize.Swap($S, &$L{})",
                            ProtocolUtils.OPERATION_DESERIALIZER_MIDDLEWARE_ID.getString(),
                            getDeserializeMiddlewareName(service, operation)
                    );
                    writer.write("if err != nil { return err }");
                    writer.write("return nil");
                });
    }
/**
     * writes helper function to swap deserialization middleware with the generated
     * custom deserializer middleware.
     *
     * @param writer    is the go writer used
     * @param operation is the operation for which swap function is written.
     */
writes helper function to swap deserialization middleware with the generated
custom deserializer middleware.

@param writer    is the go writer used
@param operation is the operation for which swap function is written.
writes helper function to swap deserialization middleware with the generated custom deserializer middleware . @param writer is the go writer used @param operation is the operation for which swap function is written .
private void writeDeserializerSwapFunction(
            GoWriter writer,
            ServiceShape service,
            OperationShape operation
    ) {
        writer.writeDocs("Helper to swap in a custom deserializer");
        writer.openBlock("func $L(stack *middleware.Stack) error{", "}",
                swapDeserializerFuncName, () -> {
                    writer.write("_, err := stack.Deserialize.Swap($S, &$L{})",
                            ProtocolUtils.OPERATION_DESERIALIZER_MIDDLEWARE_ID.getString(),
                            getDeserializeMiddlewareName(service, operation)
                    );
                    writer.write("if err != nil { return err }");
                    writer.write("return nil");
                });
    }
private void writeDeserializerSwapFunction ( GoWriter writer , ServiceShape service , OperationShape operation ) { writer . writeDocs ( "Helper to swap in a custom deserializer" ) ; writer . openBlock ( "func $L(stack *middleware.Stack) error{" , "}" , swapDeserializerFuncName , ( ) -> { writer . write ( "_, err := stack.Deserialize.Swap($S, &$L{})" , ProtocolUtils . OPERATION_DESERIALIZER_MIDDLEWARE_ID . getString ( ) , getDeserializeMiddlewareName ( service , operation ) ) ; writer . write ( "if err != nil { return err }" ) ; writer . write ( "return nil" ) ; } ) ; }
writes helper function to swap deserialization middleware with the generated
 custom deserializer middleware.
writes helper function to swap deserialization middleware with the generated custom deserializer middleware .