INNER CODE UNIT · Go

func

easegress-io/easegress · cmd/client/commandv2/convert/nginx/cmd.go:94

func (opt *Options) init() {
	opt.usedNames = make(map[string]struct{})
	opt.usedNames[""] = struct{}{}
}

// GetPipelineName creates a globally unique name for the pipeline based on the path.
func (opt *Options) GetPipelineName(path string) string {
	letters := []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
	nameRunes := make([]rune, 0)
	for _, r := range path {
		if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9') {
			nameRunes = append(nameRunes, r)
		}
	}
	name := string(nameRunes)
	if _, ok := opt.usedNames[name]; !ok {
		opt.usedNames[name] = struct{}{}
		return fmt.Sprintf("%s-%s", opt.ResourcePrefix, name)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…