KRT Utils
This repo contains tools to create and validate KRT files.
Frameworks and libraries
Usage
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)
}
}
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