import os
import fnmatch
def print_directory_tree(start_path):
for root, dirs, files in os.walk(start_path, topdown=True):
# Exclude .git directory
if '.git' in dirs:
dirs.remove('.git')
level = root.replace(start_path, '').count(os.sep)
indent = ' ' * 4 * level
print('{}{}/'.format(indent, os.path.basename(root)))
sub_indent = ' ' * 4 * (level + 1)
for f in files:
print('{}{}'.format(sub_indent, f))
# Print the directory tree
start_path = "."
print("```DirectoryTree")
print_directory_tree(start_path)
print("```\n")
# Define the pattern to match
pattern = "*.go"
# Find all files that match the pattern
for root, dirs, files in os.walk(".", topdown=False):
for filename in files:
if fnmatch.fnmatch(filename, pattern):
# Print the file name with its path
print("```"+os.path.join(root, filename))
# Print the source code
with open(os.path.join(root, filename), "r") as f:
print(f.read())
print("```\n")