naming

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Copyright 2026 YLD Limited SPDX-License-Identifier: Apache-2.0 Package naming provides identifier sanitization and conversion utilities for translating between HCL and YAML naming conventions. It handles dash-to-underscore mapping, identifier deduplication, and safe identifier generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SanitizeIdentifier

func SanitizeIdentifier(in string) string

SanitizeIdentifier replaces non-alphanumeric characters with underscores and ensures a valid identifier.

func ToHCLKey

func ToHCLKey(name string) string

ToHCLKey converts a name to an HCL-compatible key by replacing hyphens with underscores.

func ToYAMLKey

func ToYAMLKey(name string) string

ToYAMLKey converts a name to a YAML-compatible key by replacing underscores with hyphens.

func UniqueIdentifier

func UniqueIdentifier(base string, existing []string) string

UniqueIdentifier returns base or a suffixed variant that does not collide with existing.

func UniqueIdentifierInSet

func UniqueIdentifierInSet(base string, existing map[string]struct{}) string

UniqueIdentifierInSet returns base or a suffixed variant not present in the existing set.

Types

This section is empty.

Jump to

Keyboard shortcuts

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