Source File
import.go
Belonging Package
go/ast
package ast
import (
)
break
}
continue
}
if len(.Specs) > 0 {
:= .Specs[len(.Specs)-1]
:= lineAt(, .Pos())
:= lineAt(, .Rparen)
for > +1 {
--
.File(.Rparen).MergeLine()
}
}
}
}
func ( *token.FileSet, token.Pos) int {
return .PositionFor(, false).Line
}
func ( Spec) string {
, := strconv.Unquote(.(*ImportSpec).Path.Value)
if == nil {
return
}
return ""
}
func ( Spec) string {
:= .(*ImportSpec).Name
if == nil {
return ""
}
return .Name
}
func ( Spec) string {
:= .(*ImportSpec).Comment
if == nil {
return ""
}
return .Text()
}
func (, Spec) bool {
if importPath() != importPath() || importName() != importName() {
return false
}
return .(*ImportSpec).Comment == nil
}
type posSpan struct {
Start token.Pos
End token.Pos
}
type cgPos struct {
left bool // true if comment is to the left of the spec, false otherwise.
cg *CommentGroup
}
if len() <= 1 {
return
}
if < {
=
}
if > {
=
}
}
}
var []*CommentGroup
if >= 0 {
= .Comments[ : +1]
}
:= map[*ImportSpec][]cgPos{}
:= 0
for , := range {
for +1 < len() && [+1].Start <= .Pos() {
++
}
sort.Slice(, func(, int) bool {
:= importPath([])
:= importPath([])
if != {
return <
}
:= importName([])
:= importName([])
if != {
return <
}
return importComment([]) < importComment([])
})
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |