]> Cypherpunks repositories - gostls13.git/commit
go/ast: add ParseDirective for parsing directive comments
authorAustin Clements <austin@google.com>
Fri, 29 Aug 2025 01:40:57 +0000 (21:40 -0400)
committerGopher Robot <gobot@golang.org>
Tue, 21 Oct 2025 21:49:10 +0000 (14:49 -0700)
commit4e695dd6346e5c7f7e94f54ed177ef96249d2294
tree679a777b70dceb6462605c8acb7d17bac19374b8
parent06e57e60a7ff6cbc9c608278cbac4db514c7161a
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>
api/next/68021.txt [new file with mode: 0644]
doc/next/6-stdlib/99-minor/go/ast/68021.md [new file with mode: 0644]
src/go/ast/directive.go [new file with mode: 0644]
src/go/ast/directive_test.go [new file with mode: 0644]