omissis/go-jsonschema

View on GitHub
pkg/generator/name_scope.go

Summary

Maintainability
A
0 mins
Test Coverage
package generator

import (
    "strings"
)

type nameScope []string

func newNameScope(s string) nameScope {
    return nameScope{s}
}

func (ns nameScope) string() string {
    return strings.Join(ns, "")
}

func (ns nameScope) add(s string) nameScope {
    result := make(nameScope, len(ns)+1)
    copy(result, ns)
    result[len(result)-1] = s

    return result
}