tags

package
v0.0.0-...-2392c82 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2024 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTag

func AddTag(src string, tag string) string

AddTag searches for build tags in the Go source (src) and adds the provided tag (tag) if it doesn't already exist. The function looks for both `//go:build` (new format) and `// +build` (old format) and ensures that the new tag is added under the appropriate format. If neither build tag format exists, it adds a `//go:build` directive at the top of the file. If the tag already exists, the original source is returned.

The function doesn't attempt to rewrite the whole file but operates on the source text to add tags directly.

func HasBuildTag

func HasBuildTag(src string, tags []string) bool

HasBuildTag checks if the src contains any of the provided build tags.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL