添加抽象工厂模式示例,包含手机和笔记本电脑的具体产品及工厂实现,并更新相关文档和构建脚本

This commit is contained in:
2025-12-09 01:33:55 +08:00
parent 7498a885fc
commit c5c0cf76b2
7 changed files with 194 additions and 8 deletions
+28
View File
@@ -0,0 +1,28 @@
BUILDDIR := build
DIRS := $(shell ls -d */)
.PHONY: build
build:
mkdir -p $(BUILDDIR); \
for dir in $(DIRS); do \
if [ ! -f "$$dir/main.go" ]; then \
continue; \
fi; \
pkg=$${dir%/}; \
go build -o $(BUILDDIR)/$$pkg ./$$dir/main.go; \
done
.PHONY: test
test:
for bin in $(BUILDDIR)/*; do \
echo "\n"; \
$$bin; \
done; \
echo "\nAll Go examples executed.\n"
.PHONY: clean
clean:
rm -rf $(BUILDDIR)/*
.PHONY: all
all: build test clean