<commit_before>// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0

use crate::common;
use aptos_types::transaction::{
    ArgumentABI, ScriptABI, ScriptFunctionABI, TransactionScriptABI, TypeArgumentABI,
};
use move_deps::move_core_types::{
    account_address::AccountAddress,
    language_storage::{ModuleId, TypeTag},
};
use serde_generate::{
    golang,
    indent::{IndentConfig, IndentedWriter},
    CodeGeneratorConfig,
};

use heck::CamelCase;
use std::{
    collections::BTreeMap,
    io::{Result, Write},
    path::PathBuf,
};

/// Output transaction builders and decoders in Go for the given ABIs.
pub fn output(
    out: &mut dyn Write,
    serde_module_path: Option<String>,
    aptos_module_path: Option<String>,
    package_name: String,
    abis: &[ScriptABI],
) -> Result<()> {
    let mut emitter = GoEmitter {
        out: IndentedWriter::new(out, IndentConfig::Tab),
        serde_module_path,
        aptos_module_path,
        package_name,
    };

    // Some functions have complex types which are not currently supported in bcs or in this
    // generator. Disable those functiosn for now.
    let abis_vec = abis
        .iter()
        .cloned()
        .filter(|abi| {
            if let ScriptABI::ScriptFunction(sf) = abi {
                sf.module_name().name().as_str() != "genesis"
                    && sf.name() != "create_initialize_validators"
            } else {
                true<commit_msg>[aptos-sdk] fix go lang gen<commit_after>// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0

use crate::common;
use aptos_types::transaction::{
    ArgumentABI, ScriptABI, ScriptFunctionABI, TransactionScriptABI, TypeArgumentABI,
};
use move_deps::move_core_types::{
    account_address::AccountAddress,
    language_storage::{ModuleId, TypeTag},
};
use serde_generate::{
    golang,
    indent::{IndentConfig, IndentedWriter},
    CodeGeneratorConfig,
};

use heck::CamelCase;
use std::{
    collections::BTreeMap,
    io::{Result, Write},
    path::PathBuf,
};

/// Output transaction builders and decoders in Go for the given ABIs.
pub fn output(
    out: &mut dyn Write,
    serde_module_path: Option<String>,
    aptos_module_path: Option<String>,
    package_name: String,
    abis: &[ScriptABI],
) -> Result<()> {
    let mut emitter = GoEmitter {
        out: IndentedWriter::new(out, IndentConfig::Tab),
        serde_module_path,
        aptos_module_path,
        package_name,
    };

    // Some functions have complex types which are not currently supported in bcs or in this
    // generator. Disable those functiosn for now.
    let abis_vec = abis
        .iter()
        .cloned()
        .filter(|abi| {
            if let ScriptABI::ScriptFunction(sf) = abi {
                sf.module_name().name().as_str() != "code" && sf.name() != "publish_package_txn"
            } else {
                true
{'fraction_non_alphanumeric': 0.1213490959666203, 'fraction_numerical': 0.0013908205841446453, 'mean_word_length': 2.984764542936288, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6803995', 'n_tokens_mistral': 902, 'n_tokens_neox': 900, 'n_words': 219}