Standard library / go/build

go/build.Directive

Represents a directive comment and its source position. Expected stdout: '//go:generate echo demo\n'.

Formal Syntax & Structure

go syntaxgo
type Directive struct {  Text string  Pos  token.Position}

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/build")
func main() { x := build.Directive{Text: "//go:generate echo demo"}; fmt.Println(x.Text) }
Go Reference