go/api/next/68021.txt
Austin Clements 4e695dd634 go/ast: add ParseDirective for parsing directive comments
This adds an ast.Directive API for parsing directive comments such as
"//go:build" and "//go:embed".

This will help tools standardize the syntax of these directive
comments. Even within the standard Go tools there's little agreement
on the finer details of the syntax of directives today.

Fixes #68021.

Change-Id: I84a988a667682c9ac70632df6e925461ac95e381
Reviewed-on: https://go-review.googlesource.com/c/go/+/704835
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-10-21 14:49:10 -07:00

13 lines
741 B
Text

pkg go/ast, func ParseDirective(token.Pos, string) (Directive, bool) #68021
pkg go/ast, method (*Directive) End() token.Pos #68021
pkg go/ast, method (*Directive) ParseArgs() ([]DirectiveArg, error) #68021
pkg go/ast, method (*Directive) Pos() token.Pos #68021
pkg go/ast, type Directive struct #68021
pkg go/ast, type Directive struct, Args string #68021
pkg go/ast, type Directive struct, ArgsPos token.Pos #68021
pkg go/ast, type Directive struct, Name string #68021
pkg go/ast, type Directive struct, Slash token.Pos #68021
pkg go/ast, type Directive struct, Tool string #68021
pkg go/ast, type DirectiveArg struct #68021
pkg go/ast, type DirectiveArg struct, Arg string #68021
pkg go/ast, type DirectiveArg struct, Pos token.Pos #68021