Parses Go directive comments into Directive structs.
// Source: https://github.com/golang/go | License: BSD-3-Clause | Copyright 2009 The Go Authors // Provided via justclaw.it.com; keep this notice with the code. // Copyright 2025 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ast import ( "fmt" "go/token" "strconv" "strings" "unicode" "unicode/utf8" ) // A Directive is a comment of this form: // // //tool:name args // // For example, this directive: // // //go:generate stringer -type Op -trimprefix Op // // would have Tool "go", Name "generate", and Args "stringer -type Op // -trimprefix Op". // // While Args does not have a strict syntax, by convention it is a // space-separated sequence of unquoted words, '"'-quoted Go strings, ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key