PackageTrack
Sign in Get early access

github.com/cohesivestack/valgo

v0.9.1 #3562 most downloaded on Go modules cohesivestack/valgo

What this package is like to depend on

Last release 5 days ago

18 Aug 2026

Ships unpredictably

gaps range from 1 weeks to 1.2 years

Some releases are documented

notes for 10 of 18 stable releases

Nothing withdrawn

no release was ever pulled

7 years old

39 releases · first in 2019

10 releases in the last 12 months

see the full history below

Release timeline

39 releases · May 2019 to Aug 2026
2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 39
  1. v0.9.1 18 Aug 2026
    Release notes

    Added

    • ValidatorString.EqualFold and ValidatorStringP.EqualFold for case-insensitive string validation.
    • is.StringEqualFold and is.StringPEqualFold for the equivalent stateless predicates.

    Notes

    EqualFold uses Go's strings.EqualFold Unicode simple case folding. It does not normalize text or apply full case folding. Pointer comparisons return false for nil values.

    Open source →
  2. v0.9.0 15 Aug 2026
    Release notes

    Valgo v0.9.0

    Valgo v0.9.0 modernizes the numeric constructor API around Go generics and introduces reusable stateless validation predicates.

    Generalized numeric constructors

    The primary numeric constructors now accept every type in their respective families:

    • Int() and IntP() support all signed integer widths.
    • Uint() and UintP() support all unsigned integer widths.
    • Float() and FloatP() support float32 and float64.
    • User-defined numeric types remain fully type-safe.
    type Attempts int8
    
    attempts := Attempts(3)
    limit := uint32(100)
    ratio := float32(0.75)
    
    v.Int(attempts).Between(0, 5)
    v.Uint(limit).GreaterThan(0)
    v.Float(ratio).Between(0, 1)

    The specialized constructors originated before Go supported generics. With Valgo now targeting modern Go versions, separate constructors for every numeric width no longer provide additional behavior or type safety.

    The following constructors are now deprecated compatibility aliases:

    • Int8, Int16, Int32, Int64, and their pointer variants
    • Uint8, Uint16, Uint32, Uint64, and their pointer variants
    • Float32, Float64, and their pointer variants

    Existing code continues to work. New code should use Int, Uint, Float, and their pointer forms.

    Rune/RuneP and Byte/ByteP remain supported because they communicate semantic meaning rather than only storage width.

    Stateless validation predicates

    The new github.com/cohesivestack/valgo/is package exposes Valgo’s built-in validation rules as type-safe boolean functions:

    import "github.com/cohesivestack/valgo/is"
    
    valid := !is.StringBlank(name) &&
      is.StringLengthBetween(name, 2, 80) &&
      is.IntGreaterOrEqualTo(stock, int16(0))

    These predicates can be used in ordinary Go control flow, application-specific validation helpers, and third-party validators that want to share Valgo’s rule semantics while providing their own contexts, errors, chaining, or localization.

    Valgo’s built-in validators now use the same predicates internally, keeping their behavior aligned.

    Migrating

    Migration only requires changing constructor names:

    v.Int16(value)    // Deprecated
    v.Int(value)      // Preferred
    
    v.Float64P(&rate) // Deprecated
    v.FloatP(&rate)   // Preferred

    The inferred value type and available validation rules remain unchanged.

    Documentation

    • Added a complete guide to stateless predicates.
    • Expanded numeric constructor and migration documentation.
    • Updated reusable-validation examples and the rule index.
    • Archived the v0.8.1 documentation under its own versioned route.
    • Updated the bundled Valgo Agent Skill for v0.9.0.
    Open source →
  3. v0.8.2-0.20260727014106-4b462feeb57b 27 Jul 2026 pre-release

    Nothing published for this version

  4. v0.8.1 19 Jul 2026
    Release notes

    Valgo v0.8.1 Release Notes

    Valgo v0.8.1 is a backward-compatible release with shorter string length
    validator names, clearer deprecation guidance, and refreshed docs.

    What's New

    • Added shorter string length validators for String and StringP:
      ByteLength, ByteLengthBetween, Length, and LengthBetween.
    val := v.Is(
      v.String("Bob", "full_name").Not().Blank().LengthBetween(4, 20),
    )

    Deprecations

    The older Of* string length methods remain available as deprecated aliases in
    v0.8.1 and are planned for removal in v1.0:

    • OfByteLength -> ByteLength
    • OfByteLengthBetween -> ByteLengthBetween
    • OfLength -> Length
    • OfLengthBetween -> LengthBetween

    Deprecation notes were also clarified for Validation.Error,
    Validation.IsValid, and Validation.MergeErrorInRow. Prefer ToError,
    PathValid, and MergeErrorInIndex.

    Docs and Maintenance

    • Updated v0.8.1 examples and migration docs.
    • Added the v0.8 docs archive and corrected v0.7 OR operator docs.
    • Improved docs SEO metadata, sitemap handling, robots.txt, and social image.
    • Updated GitHub Actions dependencies for checkout and setup-go.

    Compatibility

    No breaking changes are intended in this release. Existing v0.8.0 code should
    continue to compile.

    Open source →
  5. v0.8.1-0.20260716024519-59c845f04098 16 Jul 2026 pre-release

    Nothing published for this version

  6. v0.8.0 16 Jul 2026
    Release notes

    Valgo v0.8.0

    Valgo v0.8.0 introduces OrElse() short-circuiting, improved localized error messages for OR groups, validation-aware conditional flows, locale fallbacks for custom validators, and a new documentation website.

    Improved OR error messages

    Or() continues to combine adjacent rules as alternatives within the same validator chain:

    val := v.Is(
      v.Int(status, "status").
        EqualTo(1).
        Or().EqualTo(2).
        Or().EqualTo(3),
    )

    When every alternative fails, Valgo now returns one localized message containing all failures:

    Status must be equal to "1"; Status must be equal to "2"; or Status must be equal to "3"
    

    OR grouping and precedence remain consistent with v0.7:

    A.Or().B.C == (A OR B) AND C
    A.B.Or().C == A AND (B OR C)
    

    Localized OR formatting is available in English, Spanish, German, and Hungarian.

    New OrElse() operator

    OrElse() introduces an OR boundary with short-circuiting. If the rule or OR group on its left succeeds, the remainder of the validator chain is skipped.

    This is useful for accepting an optional value immediately and applying additional rules only when it is present:

    val := v.Is(
      v.String(value, "value").
        Empty().
        OrElse().
        MinLength(5).
        EqualTo("test"),
    )

    This behaves as:

    Empty() OR (MinLength(5) AND EqualTo("test"))
    

    If Empty() succeeds, MinLength() and EqualTo() are not evaluated. Otherwise, validation continues through the rules on the right.

    Like Or(), OrElse() takes no arguments and uses localized, joined error messages when all alternatives fail.

    Validation-result queries

    New methods make it easier to inspect results recorded in a validation session:

    • PathValid(path) checks a field or namespace.
    • AllValid(paths...) returns whether every supplied path is valid.
    • AnyValid(paths...) returns whether at least one supplied path is valid.

    IsValid() remains available but is deprecated in favor of PathValid().

    Validation-aware conditional flows

    New fluent methods can merge validations or execute callbacks based on the current validation results:

    • IfValid()
    • IfPathValid()
    • IfAllValid()
    • IfAnyValid()
    • WhenValid()
    • WhenPathValid()
    • WhenAllValid()
    • WhenAnyValid()

    These methods help express dependent validation steps directly within a validation chain.

    Locale fallbacks for custom validators

    Custom validators can now provide default messages for their own error keys:

    context.WithLocaleFallback(locale)

    Fallback entries are used only when the active locale does not already define the key. Built-in messages and consumer overrides continue to take precedence.

    New documentation website

    This release introduces comprehensive documentation powered by Astro and Starlight, including:

    • Getting-started and migration guides
    • Validator and rule references
    • Conditional-flow and error-handling guides
    • Custom-validator documentation
    • Practical cookbook examples
    • Versioned v0.7 documentation

    Explore the documentation at [valgo.build](https://valgo.build).

    The generated Go API reference remains available at [pkg.go.dev/github.com/cohesivestack/valgo](https://pkg.go.dev/github.com/cohesivestack/valgo).

    Valgo Agent Skill

    The repository now includes a Valgo Agent Skill for supported AI coding assistants:

    npx skills add cohesivestack/valgo --skill valgo

    Go versions

    Valgo v0.8 is tested with Go 1.23 and later. Using one of these versions is recommended.

    Installation

    go get github.com/cohesivestack/[email protected]

    Full changelog: v0.7.1...v0.8.0

    Open source →
  7. v0.7.2-0.20260102095438-04628402c144 02 Jan 2026 pre-release

    Nothing published for this version

  8. v0.7.1 27 Nov 2025
    Release notes

    What's Changed

    Parent namespace invalidation support for IsValid()

    IsValid() now supports parent namespaces in nested validation structures. When a nested field is invalid, all parent namespaces are automatically marked as invalid, enabling conditional checks at any level of the object graph.

    What's new

    • Parent namespace tracking: When a field like "person.addresses[0].line1" is invalid, parent namespaces ("person", "person.addresses", "person.addresses[0]") are also marked as invalid
    • Improved IsValid() behavior: IsValid() is now parent-namespace awareness
    • Works with all namespace types: Supports dot-separated namespaces (In()) and indexed namespaces (InRow(), InCell())

    Example

    val := v.In("person",
      v.InRow("addresses", 0,
        v.Is(v.String("", "line1").Not().Blank()),
      ),
    )
    
    // Check validity at any namespace level
    if !val.IsValid("person.addresses") {
      // Handle address validation errors
    }

    Benefits

    • Write conditional logic at any namespace level without checking individual leaf fields
    • More intuitive API for nested validation structures
    Open source →
  9. v0.7.0 21 Sep 2025
    Release notes

    Valgo v0.7.0 — Ergonomics + Type-safety

    This release focuses on two things: (1) fluent control over validation flow and (2) type-safe validators that remove codegen and width-specific types. PR: #50

    New validation helpers (sessions): InCell, If, When, Do

    • InCell(name, index, v) — Run validators in an indexed namespace (great for slices of primitives or flat tables). Errors are grouped like phones[2].number, keeping messages precise without manual prefixing.
    • If(condition, validation) — Conditionally merge another validation session. Perfect for optional blocks.
    • When(condition, func(val *Validation)) — Like If, but runs a function to build rules. Keeps linear, readable control-flow.
    • Do(func(val *Validation)) — Execute custom logic with access to the session (e.g., compute, branch, or attach custom errors).

    Why this matters: these helpers eliminate boilerplate if trees around validation, preserve explicit intent, and keep error paths tied to the exact field/cell that failed.

    Numeric validators — now generic, faster to use, easier to maintain

    We replaced generated, width-specific validators with single generic types per family:

    • ValidatorInt[T ~int|~int8|~int16|~int32|~int64]
    • ValidatorUint[T ~uint|~uint8|~uint16|~uint32|~uint64]
    • ValidatorFloat[T ~float32|~float64]

    New rules include Positive()/Negative() for integers and NaN(), Infinite(), Finite() for floats. Constructors like v.Int16(...), v.Uint64(...), v.Float32(...) still work and now return the generic types. You keep your call sites; declared types may need a tweak (see “Breaking changes”).

    Why this matters: less API surface, clearer autocompletion, fewer mistakes during refactors, and no codegen to maintain.

    Comparable & Typed validators

    • ValidatorComparable[T comparable] — Type-safe equality and membership: EqualTo, InSlice, plus Passing.
    • ValidatorTyped[T] — A type-safe alternative to Any when you want custom rules on your own domain types without losing compile-time checks; includes Passing(func(T) bool) and Nil() for pointer forms.

    Why this matters: you keep Go’s type guarantees (no accidental cross-type comparisons) and still write concise, expressive rules.

    Migration & breaking changes

    • Numeric validators: width-specific types (e.g., ValidatorInt16) are replaced by generics.

      • Before: var a ValidatorInt16
      • After: var a *ValidatorInt[int16]
        Constructors (v.Int16(...), etc.) are unchanged.
    • Any.EqualTo() is deprecated; use Comparable.EqualTo() to keep type-safety.

    Quick examples

    Validate items in a slice with stable error paths:

    for i, phone := range phones {
      val = val.InCell("phones", i, v.Is(
        v.String(phone, "number").Not().Blank().OfLengthBetween(7, 15),
      ))
    }

    Conditionally attach rules with If / When:

    val.
      If(hasMiddle, v.Is(v.String(m, "middle").OfLengthBetween(2, 50))).
      When(isTrial, func(vv *v.Validation) {
        vv.Is(v.Int(daysLeft, "days_left").GreaterThan(0))
      })

    Comparable & Typed:

    // Comparable
    v.Is(v.Comparable(status, "status").InSlice([]Status{"active","paused"}))
    
    // Typed custom rule
    type Plan string
    v.Is(v.Typed(plan, "plan").Passing(func(p Plan) bool { return p == "pro" || p == "team" }))

    Bottom line: v0.7.0 gives you cleaner control-flow (InCell/If/When/Do), safer equality and domain rules (Comparable, Typed), and a smaller, more coherent numeric API with new positivity/NaN/∞ checks—without disrupting most call sites.

    Open source →
  10. v0.6.0 05 Sep 2025
    Release notes

    What's Changed

    • Add rune length validators to support non-Latin alphabet languages by @mintc2 in #46
    • Feature/expand rune tests by @carlosforero in #48

    New Contributors

    Full Changelog: v0.5.0...v0.6.0

    Open source →
  11. v0.5.0 27 Jun 2025
    Release notes

    What's Changed

    ✨ New Error Handling Functions

    This release introduces two new error handling functions for better Go integration:

    ToError() Function

    • Returns validation errors as a standard Go error interface
    • Perfect for idiomatic error handling and integration with Go's native error system

    ToValgoError() Function

    • Returns validation errors as a concrete *valgo.Error type
    • Provides access to rich, structured error details including per-field messages

    Deprecated Error() Function

    • The existing Error() function is now deprecated and will be removed in v1.0
    • This resolves naming conflicts with Go's error interface implementation convention

    🔧 Other Changes

    📚 Quick Migration

    Before (deprecated):

    val.Error() // Will be removed in v1.0

    After:

    val.ToError()      // For standard error handling
    val.ToValgoError() // For detailed error information

    Full Changelog: v0.4.2...v0.5.0

    Open source →
  12. v0.4.3-0.20250627103101-f74e7fea74d3 27 Jun 2025 pre-release

    Nothing published for this version

  13. v0.4.2 24 Jun 2025
    Release notes

    What's Changed

    New Contributors

    Full Changelog: v0.4.1...v0.4.2

    Open source →
  14. v0.4.1 08 Apr 2024
    Release notes

    What's Changed

    New Contributors

    • @gaby made their first contribution in #20

    Full Changelog: v0.4.0...v0.4.1

    Open source →
  15. v0.4.1-0.20240408035208-e90fa82dacd2 08 Apr 2024 pre-release

    Nothing published for this version

  16. v0.4.0 29 Mar 2024

    Nothing published for this version

  17. v0.3.0 17 Mar 2024

    Nothing published for this version

  18. v0.2.5-0.20240317062306-44b9a8b9ef17 17 Mar 2024 pre-release

    Nothing published for this version

  19. v0.2.5-0.20230905161715-d1107e61a612 05 Sep 2023 pre-release

    Nothing published for this version

  20. v0.2.5-0.20230905161023-84b423463b96 05 Sep 2023 pre-release

    Nothing published for this version

  21. v0.2.5-0.20230905121157-85fa2953c25c 05 Sep 2023 pre-release

    Nothing published for this version

  22. v0.2.5-0.20230410153805-9c8781df70d7 10 Apr 2023 pre-release

    Nothing published for this version

  23. v0.2.4 09 Apr 2023

    Nothing published for this version

  24. v0.2.3 17 Mar 2023

    Nothing published for this version

  25. v0.2.2 14 Mar 2023

    Nothing published for this version

  26. v0.2.2-0.20230314113128-3a6cba55a8aa 14 Mar 2023 pre-release

    Nothing published for this version

  27. v0.2.1 07 Mar 2023

    Nothing published for this version

  28. v0.2.1-0.20230219162514-b944469f9f64 19 Feb 2023 pre-release

    Nothing published for this version

  29. v0.2.0 19 Feb 2023

    Nothing published for this version

  30. v0.1.0 04 Dec 2022

    Nothing published for this version

  31. v0.0.0-20221108170755-41af02d64db5 08 Nov 2022 pre-release

    Nothing published for this version

  32. v0.0.0-20221031191228-0db1cbe7ac7c 31 Oct 2022 pre-release

    Nothing published for this version

  33. v0.0.0-20210914230158-9b1df9933396 14 Sep 2021 pre-release

    Nothing published for this version

  34. v0.0.0-20210914221833-687739b9f1ec 14 Sep 2021 pre-release

    Nothing published for this version

  35. v0.0.0-20210521201014-f55b61fbaeb0 21 May 2021 pre-release

    Nothing published for this version

  36. v0.0.0-20200514001853-00298a7a0fd2 14 May 2020 pre-release

    Nothing published for this version

  37. v0.0.0-20200512003659-8ca362a7c703 12 May 2020 pre-release

    Nothing published for this version

  38. v0.0.0-20191230152757-2680ecd6606f 30 Dec 2019 pre-release

    Nothing published for this version

  39. v0.0.0-20190513035213-4a72685acfca 13 May 2019 pre-release

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive