public void exportTypesToGDT(File gdtFile, boolean runtimeFuncSnapshot, TaskMonitor monitor)
			throws IOException, CancelledException {

		List<DataType> bootstrapFuncDefs = runtimeFuncSnapshot
				? createBootstrapFuncDefs(program.getDataTypeManager(),
					GoConstants.GOLANG_BOOTSTRAP_FUNCS_CATEGORYPATH, monitor)
				: List.of();

		List<DataType> registeredStructDTs = mappingInfo.values()
				.stream()
				.map(this::structMappingInfoToDataType)
				.filter(Objects::nonNull)
				.toList();

		// Copy the data types into a tmp gdt, and then copy them again into the final gdt
		// to avoid traces of the original program name as a deleted source archive link in the
		// gdt data base.  This method only leaves the target gdt filename + ".step1" in the db.
		File tmpGDTFile = new File(gdtFile.getParentFile(), gdtFile.getName() + ".step1.gdt");
		FileDataTypeManager tmpFdtm = FileDataTypeManager.createFileArchive(tmpGDTFile);
		int tx = tmpFdtm.startTransaction("Import");
		try {
			tmpFdtm.addDataTypes(registeredStructDTs, DataTypeConflictHandler.DEFAULT_HANDLER,
				monitor);
			if (runtimeFuncSnapshot) {
				tmpFdtm.addDataTypes(bootstrapFuncDefs, DataTypeConflictHandler.KEEP_HANDLER,
					monitor);
			}
			moveAllDataTypesTo(tmpFdtm, DWARFProgram.DWARF_ROOT_CATPATH, GOLANG_CP);
			for (SourceArchive sa : tmpFdtm.getSourceArchives()) {
				tmpFdtm.removeSourceArchive(sa);
			}
			tmpFdtm.getRootCategory()
					.removeCategory(DWARFProgram.DWARF_ROOT_CATPATH.getName(), monitor);

			// Nuke descriptions in all data types.  Most likely are DWARF debug data, etc that would
			// be specific to the example program.
			for (Iterator<DataType> it = tmpFdtm.getAllDataTypes(); it.hasNext();) {
				DataType dt = it.next();
				if (dt.getDescription() != null) {
					if (dt instanceof Composite &&
						!GoFunctionMultiReturn.isMultiReturnDataType(dt)) {
						// don't nuke the generic warning in the multi-return data type						
						dt.setDescription(null);
					}
				}
				if (dt instanceof FunctionDefinition funcDef) {
					funcDef.setComment(null);
				}
			}
		}
		catch (CancelledException | DuplicateNameException | DataTypeDependencyException
				| InvalidNameException e) {
			Msg.error(this, "Error when exporting types to file: %s".formatted(gdtFile), e);
		}
		finally {
			tmpFdtm.endTransaction(tx, true);
		}

		tmpFdtm.save();

		FileDataTypeManager fdtm = FileDataTypeManager.createFileArchive(gdtFile);
		tx = fdtm.startTransaction("Import");
		try {
			tmpFdtm.getAllDataTypes()
					.forEachRemaining(
						dt -> fdtm.addDataType(dt, DataTypeConflictHandler.DEFAULT_HANDLER));
			for (SourceArchive sa : fdtm.getSourceArchives()) {
				fdtm.removeSourceArchive(sa);
			}
		}
		finally {
			fdtm.endTransaction(tx, true);
		}

		fdtm.save();

		tmpFdtm.close();
		fdtm.close();

		tmpGDTFile.delete();
	}
Export the currently registered struct mapping types to a gdt file, producing a bootstrap
GDT archive.
<p>
The struct data types will either be from the current program's DWARF data, or
from an earlier golang.gdt (if this binary doesn't have DWARF)

@param gdtFile destination {@link File} to write the bootstrap types to
@param runtimeFuncSnapshot boolean flag, if true include function definitions
@param monitor {@link TaskMonitor}
@throws IOException if error
@throws CancelledException if cancelled
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/golang/rtti/GoRttiMapper.java