Skip to content

Create LICENSE#1

Merged
stevemk14ebr merged 1 commit intomasterfrom
add-license-1
Feb 15, 2022
Merged

Create LICENSE#1
stevemk14ebr merged 1 commit intomasterfrom
add-license-1

Conversation

@stevemk14ebr
Copy link
Collaborator

Permissive - have fun :)

@stevemk14ebr stevemk14ebr merged commit 480535b into master Feb 15, 2022
@stevemk14ebr stevemk14ebr deleted the add-license-1 branch February 15, 2022 19:42
kami922 added a commit to kami922/GoReSym that referenced this pull request Jan 12, 2026
…adata with enums; generic parsers updated; tests adjusted; add InterfaceLayout scaffolding
stevemk14ebr pushed a commit that referenced this pull request Jan 13, 2026
* Refactor moduledata parsing using field offset tables (Issue #55)

This commit refactors moduledata parsing for Go versions 1.16-1.24 to use
a data-driven approach with field offset tables instead of repetitive
version-specific switch statements.

Changes:
- Add objfile/layouts.go with generic field offset layout system
- Add objfile/layouts_test.go with comprehensive test coverage
- Refactor objfile/objfile.go to use generic parser for Go 1.16-1.24
- Reduce code from ~430 lines of switches to ~60 lines of generic code

Benefits:
- 85% code reduction for supported versions (430 → 62 lines)
- Adding new Go versions requires only ~8 lines of layout data
- Single parsing logic eliminates duplicate code
- Comprehensive test suite ensures correctness

Testing:
- All existing tests pass
- New tests verify layout offsets match struct definitions
- Backward compatibility tests ensure identical output
- Tested against real Go 1.17.2 binary (testproject)

Fixes #55

* Extend moduledata refactoring to Go 1.5-1.15 (Issue #55)

Extends the layout table approach to older Go versions (1.5-1.15),
eliminating 228 lines of repetitive switch statements.

Changes:
- Add layout definitions for Go 1.5-1.6, 1.7, and 1.8-1.15 to layouts.go
- Add validateAndConvertModuleData_Legacy() for Go 1.7-1.15
- Add validateAndConvertModuleData_Legacy_NoTypes() for Go 1.5-1.6
- Refactor objfile.go case "1.2" block (228 lines → 75 lines)
- Add comprehensive tests for legacy versions (17 new test cases)

Benefits:
- 67% code reduction in legacy version handling
- Consistent parsing approach across Go 1.5-1.24 (20 versions)
- Improved maintainability and extensibility
- Single source of truth for moduledata layouts

Testing:
- All existing unit tests pass
- Added TestLayoutOffsets_Legacy_Versions (6 subtests)
- Added TestVersionMapping_Legacy (11 subtests)
- Total: 17 new test cases validating legacy version support

Code Metrics:
- objfile/objfile.go: 1,783 → 1,628 lines (-155 lines)
- objfile/layouts.go: 436 → 564 lines (+128 lines infrastructure)
- objfile/layouts_test.go: 380 → 590 lines (+210 lines tests)
- Net: -155 lines of duplicate code eliminated

Addresses maintainer feedback on PR #78 (moduledata portion).
Type parsing refactoring (Phase 2) to follow in next commit.

* Extend type parsing refactoring to all Go versions (Issue #55)

Refactors type parsing (ParseType_impl) to use the layout table approach,
eliminating 158 lines of repetitive version-specific switch statements.

Changes:
- Add RtypeLayout system to layouts.go for Go 1.5-1.24
- Add parseRtypeGeneric() for generic type parsing
- Add getRtypeFieldOffset() helper function
- Refactor ParseType_impl() to use generic parser (208 lines → 50 lines)
- Add comprehensive tests for Rtype layouts (23 test cases)

Benefits:
- 76% code reduction in type parsing (208 lines → 50 lines)
- Consistent parsing approach for all Go 1.5-1.24 type structures
- Single source of truth for Rtype layouts
- Improved maintainability

Testing:
- All existing tests pass
- Added TestRtypeLayoutOffsets (3 subtests)
- Added TestRtypeVersionMapping (20 subtests)
- Total: 23 new test cases validating Rtype support

Code Metrics:
- objfile/objfile.go: 1,628 → 1,470 lines (-158 lines)
- objfile/layouts.go: 564 → 786 lines (+222 lines infrastructure)
- objfile/layouts_test.go: 590 → 748 lines (+158 lines tests)

Combined with Phase 1:
- Total code reduction: 313 lines from objfile.go
- ModuleData + Type parsing: ~650 lines → ~125 lines (81% reduction)

Completes maintainer feedback on PR #78 (type parsing portion).

* PR #78: Change #1 complete – replace string field metadata with enums; generic parsers updated; tests adjusted; add InterfaceLayout scaffolding
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