Skip to content

Commit 567ab3d

Browse files
LessUpqwencoder
andcommitted
refactor: 标准化Go模块结构,统一library+cmd/模式
- Huffman/Arithmetic/RLE Go模块重构为library+huffman/cmd/main.go - 所有Go模块现在使用一致的library+cmd/目录结构 - 删除specs/api/和specs/db/占位目录 - 更新AGENTS.md移除对specs/api的引用 - 更新Makefile和CI工作流使用新的cmd/路径 - 更新测试文件使用新的包结构 Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1 parent e09867c commit 567ab3d

17 files changed

Lines changed: 884 additions & 836 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@ jobs:
194194
(cd algorithms/rle/cpp && g++ -std=c++17 -O2 main.cpp -o rle_cpp)
195195
196196
# Go
197-
(cd algorithms/huffman/go && go build -o huffman_go .)
198-
(cd algorithms/arithmetic/go && go build -o arithmetic_go .)
197+
(cd algorithms/huffman/go && go build -o huffman_go ./cmd)
198+
(cd algorithms/arithmetic/go && go build -o arithmetic_go ./cmd)
199199
(cd algorithms/range/go && go build -o rangecoder_go ./cmd)
200-
(cd algorithms/rle/go && go build -o rle_go .)
200+
(cd algorithms/rle/go && go build -o rle_go ./cmd)
201201
202202
# Rust
203203
(cd algorithms/huffman/rust && rustc -O main.rs -o huffman_rust)

AGENTS.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ This project strictly follows the **Spec-Driven Development (SDD)** paradigm. Al
88
|-----------|---------|
99
| `/specs/product/` | Product feature definitions and acceptance criteria |
1010
| `/specs/rfc/` | Technical design documents (architecture, patterns, decisions) |
11-
| `/specs/api/` | API interface definitions (OpenAPI, GraphQL schemas) |
12-
| `/specs/db/` | Database model definitions |
1311
| `/specs/testing/` | Test specifications and BDD test cases |
1412
| `/docs/` | User-facing documentation (VitePress documentation site) |
1513

@@ -43,7 +41,7 @@ When you (AI) are asked to develop a new feature, modify an existing one, or fix
4341

4442
## Code Generation Rules
4543

46-
- Any externally exposed API changes must synchronously update the relevant spec files in `/specs/api/`.
44+
- Any changes to binary file formats, CLI interfaces, or error handling must synchronously update the relevant spec files in `/specs/rfc/`.
4745
- If uncertain about technical details, consult the architecture conventions in `/specs/rfc/`. Do not invent design patterns on your own.
4846
- All error messages must be in English.
4947
- Follow language-specific conventions:

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ build: build-huffman build-arithmetic build-range build-rle
99

1010
build-huffman:
1111
g++ -std=c++17 -O2 -Wall -Wextra -Werror algorithms/huffman/cpp/main.cpp -o algorithms/huffman/cpp/huffman_cpp
12-
go build -o algorithms/huffman/go/huffman_go ./algorithms/huffman/go
12+
go build -o algorithms/huffman/go/huffman_go ./algorithms/huffman/go/cmd
1313
rustc -O algorithms/huffman/rust/main.rs -o algorithms/huffman/rust/huffman_rust
1414

1515
build-arithmetic:
1616
g++ -std=c++17 -O2 -Wall -Wextra -Werror algorithms/arithmetic/cpp/main.cpp -o algorithms/arithmetic/cpp/arithmetic_cpp
17-
go build -o algorithms/arithmetic/go/arithmetic_go ./algorithms/arithmetic/go
17+
go build -o algorithms/arithmetic/go/arithmetic_go ./algorithms/arithmetic/go/cmd
1818
rustc -O algorithms/arithmetic/rust/main.rs -o algorithms/arithmetic/rust/arithmetic_rust
1919

2020
build-range:
@@ -24,7 +24,7 @@ build-range:
2424

2525
build-rle:
2626
g++ -std=c++17 -O2 -Wall -Wextra -Werror algorithms/rle/cpp/main.cpp -o algorithms/rle/cpp/rle_cpp
27-
go build -o algorithms/rle/go/rle_go ./algorithms/rle/go
27+
go build -o algorithms/rle/go/rle_go ./algorithms/rle/go/cmd
2828
rustc -O algorithms/rle/rust/main.rs -o algorithms/rle/rust/rle_rust
2929

3030
# ── Test ───────────────────────────────────────────────────────────────────
@@ -34,16 +34,16 @@ test: test-data \
3434
test-huffman-rust test-arithmetic-rust test-range-rust test-rle-rust
3535

3636
test-huffman-go:
37-
go test ./algorithms/huffman/go/...
37+
go test ./algorithms/huffman/go/... ./algorithms/huffman/go/cmd/...
3838

3939
test-arithmetic-go:
40-
go test ./algorithms/arithmetic/go/...
40+
go test ./algorithms/arithmetic/go/... ./algorithms/arithmetic/go/cmd/...
4141

4242
test-range-go:
4343
go test ./algorithms/range/go/...
4444

4545
test-rle-go:
46-
go test ./algorithms/rle/go/...
46+
go test ./algorithms/rle/go/... ./algorithms/rle/go/cmd/...
4747

4848
test-huffman-rust:
4949
rustc --test algorithms/huffman/rust/main.rs -o algorithms/huffman/rust/huffman_rust_test

0 commit comments

Comments
 (0)