Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/pkgsite: so bueatifull goto syntax for parse text but compile error #70569

Closed
epowsal opened this issue Nov 26, 2024 · 2 comments
Closed

x/pkgsite: so bueatifull goto syntax for parse text but compile error #70569

epowsal opened this issue Nov 26, 2024 · 2 comments
Labels
Milestone

Comments

@epowsal
Copy link

epowsal commented Nov 26, 2024

What is the URL of the page with the issue?

no

What is your user agent?

no

Screenshot

no

What did you do?

func (de *Describle) ParseLi() bool {
var tw []byte
i := 0

tw = de.li[i:i]
for ; i < len(de.li) && de.li[i] == '\t'; i += 1 {
	tw = append(tw, de.li[i])
}
ss := NewSimpleSentence(tw)
de.ss = append(de.ss, ss)
tw = tw[:0]

jump:
if i < len(de.li) {
switch de.li[i] {
case '"':
goto biquote
case ''':
goto singlequote
case ':':
goto colon
case ';':
goto semicolon
default:
goto other
}
} else {
goto end
}

semicolon:
if len(tw) > 0 {
ss := NewSimpleSentence(tw)
de.ss = append(de.ss, ss)
}
i += 1
tw = de.li[i:i]
for ; i < len(de.li) && !(de.li[i] == '"' || de.li[i] == ''' || de.li[i] == ':' || de.li[i] == ';'); i += 1 {
tw = append(tw, de.li[i])
}
goto jump

colon:
if len(tw) > 0 {
ss := NewSimpleSentence(tw)
de.ss = append(de.ss, ss)
}
tw = de.li[i:i]
for ; i < len(de.li) && de.li[i] == ':'; i += 1 {
tw = append(tw, de.li[i])
}
ss := NewSimpleSentence(tw)
de.ss = append(de.ss, ss)
tw = de.li[i:i]
goto jump

biquote:
bqs := de.li[i]
var bqs1 byte
if i+1 < len(de.li) && de.li[i+1] == '"' {
bqs1 = de.li[i+1]
tw = append(tw, de.li[i])
i += 1
}
tw = append(tw, de.li[i])
i += 1
for ; i < len(de.li); i += 1 {
switch de.li[i] {
case bqs:
if bqs1 == 0 {
tw = append(tw, de.li[i])
i += 1
goto jump
} else {
if i+1 < len(de.li) && de.li[i+1] == '"' {
tw = append(tw, de.li[i])
tw = append(tw, de.li[i+1])
i += 2
goto jump
} else {
tw = append(tw, de.li[i])
}
}
default:
tw = append(tw, de.li[i])
}
}
goto jump

singlequote:
sqs := de.li[i]
var sqs1 byte
if i+1 < len(de.li) && de.li[i+1] == ''' {
sqs1 = de.li[i+1]
tw = append(tw, de.li[i])
i += 1
}
tw = append(tw, de.li[i])
i += 1
for ; i < len(de.li); i += 1 {
switch de.li[i] {
case sqs:
if sqs1 == 0 {
tw = append(tw, de.li[i])
i += 1
goto jump
} else {
if i+1 < len(de.li) && de.li[i+1] == ''' {
tw = append(tw, de.li[i])
tw = append(tw, de.li[i+1])
i += 2
goto jump
} else {
tw = append(tw, de.li[i])
}
}
default:
tw = append(tw, de.li[i])
}
}
goto jump

other:
for ; i < len(de.li) && !(de.li[i] == '"' || de.li[i] == ''' || de.li[i] == ':' || de.li[i] == ';'); i += 1 {
tw = append(tw, de.li[i])
}
goto jump

end:
if le(tw) > 0 {
ss := NewSimpleSentence(tw)
de.ss = append(de.ss, ss)
}

de.parsewg.Done()
return false

}

What did you see happen?

.\diskpoda_ai_describle.go:67:9: goto biquote jumps over declaration of ss at .\diskpoda_ai_describle.go:102:5
.\diskpoda_ai_describle.go:69:9: goto singlequote jumps over declaration of bqs1 at .\diskpoda_ai_describle.go:109:6

but ss is in block.it should compile pass theough.
bqs1 is right positionn should compile pass thorough.

What did you expect to see?

compile pass through

@gopherbot gopherbot added this to the Unreleased milestone Nov 26, 2024
@gabyhelp
Copy link

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@seankhliao
Copy link
Member

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Nov 26, 2024
@golang golang locked as spam and limited conversation to collaborators Nov 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants