mirror of
https://github.com/tufanbarisyildirim/gonginx.git
synced 2026-04-27 00:35:51 +03:00
[PR #62] [MERGED] Fix/get more than2 level parent directive err #63
Labels
No labels
bug
enhancement
good first issue
pull-request
question
v2
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/gonginx#63
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/tufanbarisyildirim/gonginx/pull/62
Author: @mofantor
Created: 12/22/2024
Status: ✅ Merged
Merged: 12/25/2024
Merged by: @tufanbarisyildirim
Base:
master← Head:fix/GetMoreThan2LevelParentDirectiveErr📝 Commits (2)
d6505f3Fix GetParent and change Parent type to IDirectiveaa73e3cupdate user guide📊 Changes
13 files changed (+145 additions, -46 deletions)
View changed files
📝
GUIDE.md(+6 -6)📝
config/block.go(+3 -3)📝
config/directive.go(+3 -3)📝
config/http.go(+3 -3)📝
config/include.go(+3 -3)📝
config/location.go(+19 -3)📝
config/lua_block.go(+3 -3)📝
config/server.go(+32 -3)📝
config/statement.go(+4 -4)📝
config/upstream.go(+3 -3)📝
config/upstream_server.go(+3 -3)📝
parser/parser.go(+10 -1)📝
parser/parser_test.go(+53 -8)📄 Description
Fix Issue with
GetParentMethodProblem Description:
I discovered that when obtaining a directive and attempting to retrieve its parent node more than twice, an error would occur. After investigation, I found that this issue arises because the
SetParentmethod sets the parent as the block of the parent directive rather than the parent directive itself.Solution:
To address this, I modified the
SetParentandGetParentmethods so that for each directive, its parent should be another directive rather than a block. This ensures that the parent-child relationship between directives is correctly maintained.Test Case:
The following test case previously failed due to the issue but now runs successfully after the fix: