Standard library / go/types

go/types.Package.String()

Formats package name and path for diagnostics. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (pkg *Package) String() string

Return Value

string

Formats package name and path for diagnostics.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/types"  "strings")
func main() { v := types.NewPackage("demo", "p"); fmt.Println(strings.Contains(v.String(), "demo")) }
Go Reference