in lib/generator.js [3897:3933]
visitHeader(__module, packageName, level) {
this.header = '';
if (!this.editable) {
this.header += `// This file is auto-generated, don't edit it. Thanks.\n`;
}
this.header += `package ${packageName}\n\n`;
this.header += `import (\n`;
const imports = [];
if(this.mainModule) {
if (this.exec) {
imports.push(` "os"`);
}
if (this.goPackages.length > 0) {
this.goPackages.map(pack => {
imports.push(pack);
});
}
}
this.imports.map(im => {
let tmpStr = ' ';
if(im.aliasId) {
tmpStr += `${_importFilter(_format(im.aliasId).toLowerCase())} `;
}
tmpStr += `"${im.pkgName}"`;
imports.push(tmpStr);
});
imports.push(` "github.com/alibabacloud-go/tea/dara"`);
this.builtinModule.forEach(builtinModule => {
let content = ' ';
if(builtinModule.name) {
content += `${builtinModule.name} `;
}
content += `"${builtinModule.path}"`;
imports.push(content);
});
this.header += [...new Set(imports)].join('\n') + '\n)\n\n';
}