Standard library / go/doc/comment
go/doc/comment.DefaultLookupPackage()
Recognizes default standard-library package names, not arbitrary package aliases. Expected stdout: 'fmt true\n'.
Formal Syntax & Structure
go syntaxgo
func DefaultLookupPackage(name string) (importPath string, ok bool)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | string | Name of the symbol or package. |
Return Value
(importPath string, ok bool)
Recognizes default standard-library package names, not arbitrary package aliases.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/doc/comment")
func main() { p, ok := comment.DefaultLookupPackage("fmt"); fmt.Println(p, ok) }