Skip to content

refactor: reorganize Go packages under src/ folder#30

Merged
deicon merged 2 commits intodevelopfrom
refactor/introduce-src-folder
Nov 23, 2025
Merged

refactor: reorganize Go packages under src/ folder#30
deicon merged 2 commits intodevelopfrom
refactor/introduce-src-folder

Conversation

@deicon
Copy link
Owner

@deicon deicon commented Nov 23, 2025

Summary

This PR reorganizes the project structure by moving all Go library packages under a new src/ directory for better organization and clarity.

Changes Made

Directory Structure

  • Created new src/ directory
  • Moved 7 Go packages to src/:
    • parser/src/parser/
    • runner/src/runner/
    • reporting/src/reporting/
    • metrics/src/metrics/
    • http/src/http/
    • template/src/template/
    • converter/src/converter/

Import Path Updates

  • Updated all import paths from github.com/deicon/httprunner/{package}
  • To: github.com/deicon/httprunner/src/{package}
  • Total of 29 Go files updated

Documentation

  • Updated AGENTS.md project structure section
  • Updated README.md project structure diagram

Kept at Root Level

  • cmd/ - CLI entry points (standard Go convention)
  • testapi/ - Standalone test service
  • tests/ - Test scenarios

Verification

Build: Both binaries compile successfully
Tests: All 13 test packages pass
Coverage: Maintained at same levels
Lint: All linting checks pass
Functionality: No functional changes

Test Results

ok  github.com/deicon/httprunner/cmd/harparser         (81.5% coverage)
ok  github.com/deicon/httprunner/cmd/httprunner        (43.6% coverage)
ok  github.com/deicon/httprunner/src/converter/k6      (79.6% coverage)
ok  github.com/deicon/httprunner/src/metrics           (88.0% coverage)
ok  github.com/deicon/httprunner/src/parser            (88.7% coverage)
ok  github.com/deicon/httprunner/src/reporting         (85.0% coverage)
ok  github.com/deicon/httprunner/src/runner            (65.0% coverage)
ok  github.com/deicon/httprunner/src/template          (42.8% coverage)

Benefits

  • Cleaner root directory: Better separation of concerns
  • Improved organization: All library code centralized in one location
  • Standard structure: Follows common Go project patterns
  • Easier navigation: Clear distinction between packages, commands, and tests

Breaking Changes

None. This is purely an internal reorganization.

  • No external API changes
  • No functional changes
  • All existing functionality preserved

Additional Notes

  • Makefile, Dockerfile, and docker-compose.yml require no changes
  • All build targets work unchanged (use ./... which auto-discovers packages)
  • Applied De Morgan's law in k6 generator for lint compliance

Move 7 Go packages to src/ directory:
- parser, runner, reporting, metrics, http, template, converter

Update all import paths:
- From: github.com/deicon/httprunner/{package}
- To: github.com/deicon/httprunner/src/{package}

Update documentation:
- AGENTS.md: project structure section
- README.md: project structure diagram

Maintain root-level directories per Go conventions:
- cmd/, testapi/, tests/

Verification:
- All tests pass
- Builds successful
- Coverage maintained
- Zero functional changes
- No breaking changes to external interfaces
- Apply De Morgan's law in k6 generator for lint compliance

Benefits:
- Cleaner root directory structure
- Clear separation of source code from config/docs/tests
- Better project organization with centralized library code
@deicon deicon merged commit d7f3d4c into develop Nov 23, 2025
13 checks passed
@deicon deicon deleted the refactor/introduce-src-folder branch November 23, 2025 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant