Standard library / go/build
go/build.IsLocalImport()
Reports whether an import path uses local relative syntax. Expected stdout: 'true false\n'.
Formal Syntax & Structure
go syntaxgo
func IsLocalImport(path string) boolParameters & Attributes
| Name | Type | Description |
|---|---|---|
| path | string | Package import path. |
Return Value
bool
Reports whether an import path uses local relative syntax.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/build")
func main() { fmt.Println(build.IsLocalImport("./demo"), build.IsLocalImport("fmt")) }