diff options
author | WeidiDeng <weidi_deng@icloud.com> | 2023-07-13 04:32:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-12 14:32:22 -0600 |
commit | bbe1952a59a196b7598c6488beb770ec38a70dfc (patch) | |
tree | 24b670b7a4c6c4293dda378a0def0f9706a9df1a /caddyconfig/caddyfile/parse.go | |
parent | 0e2c7e1d35b287fc0e56d6db2951f791e09b5a37 (diff) |
caddyfile: Fix comparing if two tokens are on the same line (#5626)
* fix comparing if two tokens are on the same line
* compare tokens from copies when importing
Diffstat (limited to 'caddyconfig/caddyfile/parse.go')
-rw-r--r-- | caddyconfig/caddyfile/parse.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/caddyconfig/caddyfile/parse.go b/caddyconfig/caddyfile/parse.go index 81181a4..0a1a9e7 100644 --- a/caddyconfig/caddyfile/parse.go +++ b/caddyconfig/caddyfile/parse.go @@ -464,7 +464,7 @@ func (p *parser) doImport(nesting int) error { // format, won't check for nesting correctness or any other error, that's what parser does. if !maybeSnippet && nesting == 0 { // first of the line - if i == 0 || importedTokens[i-1].File != token.File || importedTokens[i-1].Line+importedTokens[i-1].NumLineBreaks() < token.Line { + if i == 0 || isNextOnNewLine(tokensCopy[i-1], token) { index = 0 } else { index++ |