validation

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package validation provides utilities for validating generated Go code quality.

This package tests complete DynamoDB code generation templates for:

  • Format compliance (go fmt, goimports, gofumpt)
  • Compilation validation
  • Template rendering correctness

Index

Constants

View Source
const EXAMPLES = "../fixtures"

EXAMPLES define a path to JSON-schemas examples which will use for tests.

Variables

This section is empty.

Functions

func AllFormattersUnchanged

func AllFormattersUnchanged(t *testing.T, originalCode string)

AllFormattersUnchanged checks that Go formatters (go fmt, goimports, gofumpt) don't modify the provided code. This validates that the code is already properly formatted according to Go standards. Example: AllFormattersUnchanged(t, "package main\n\nfunc main() {}\n")

func CodeCompiles

func CodeCompiles(t *testing.T, code, packageName string)

CodeCompiles checks that the provided Go code compiles successfully and passes go vet. Creates a temporary module with required dependencies and attempts compilation. Example: CodeCompiles(t, generatedCode, "mypackage")

Types

type ExecResult

type ExecResult struct {
	Output string
	Error  error
	Stderr string
}

ExecResult contains the result of executing a command with stdout, stderr and error information.

Jump to

Keyboard shortcuts

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