krt-utils

module
v0.0.0-...-f6b2a55 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: MIT

README

Tests Go Report Card License

KRT Utils

This repo contains tools to create and validate KRT files.

Frameworks and libraries

Usage

  • KRT Validator
func main() {
  // Create a validator instance
  v := validator.New()

  // If you have the filename, use ParseFile
  krtFile, err := v.ParseFile("/path/to/krt.yaml")
  if err != nil {
    log.Fatal(err)
  }

  // Check valid format
  errs := v.Validate(krtFile)
  if errs != nil {
    log.Fatal(errs)
  }

  // Check all content is valid
  errs := v.ValidateContent(krtFile, "/home/test/krt")
  if errs != nil {
    log.Fatal(errs)
  }
}
  • KRT builder
package main

func main() {
  b := builder.New()

  err := builder.Build()
  if err != nil {
    log.Fatal(err)
  }

}

Run tests

go test ./...

Linters

golangci-lint is a fast Go linters runner. It runs linters in parallel, uses caching, supports yaml config, has integrations with all major IDE and has dozens of linters included.

As you can see in the .golangci.yml config file of this repo, we enable more linters than the default and have more strict settings.

To run golangci-lint execute:

golangci-lint run

Directories

Path Synopsis
_examples
pkg
krt

Jump to

Keyboard shortcuts

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