Help us shape the future of Go! Take the 2026 Go Developer Survey

pathutil

package
v0.85.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommonPrefix

func CommonPrefix(a, b string) string

func GetPath added in v0.78.0

func GetPath(m map[string]any, path string) (any, bool)

GetPath retrieves a value from a nested map using a dot-separated path. It supports accessing array elements using numeric indices in the path. For example, given the map:

{
  "user": {
    "name": "Alice",
    "addresses": [
      {"city": "New York"},
      {"city": "Los Angeles"}
    ]
  }
}

The path "user.name" would return "Alice", and the path "user.addresses.0.city" would return "New York".

func GetPathString added in v0.85.0

func GetPathString(m map[string]any, path string) (string, bool)

GetPathString is a helper around GetPath for when the expected value is a string. It returns false if the path doesn't contain a string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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