---
title: "mkideal/cli: multi-character map flag separators in Go"
description: "A fix to mkideal/cli in Go: map flags with a separator longer than one character, such as =>, no longer leave the separator's tail in the parsed value."
url: "https://vulcode.com/en/opensource/contributions/mkideal-cli"
lang: "en"
---

[All contributions](https://vulcode.com/en/opensource/contributions)

mkideal/cli

# mkideal/cli

A Go package for building command line apps, where flags are described with struct field tags.

[See the repository](https://github.com/mkideal/cli) [All contributions](https://vulcode.com/en/opensource/contributions)

- **Language**: Go
- **GitHub stars**: 723
- **Merged changes**: 1

## What we changed

Map flags with a separator longer than one character, set with the sep tag, now split the key and value using the separator's full length.

### What this work shows

- Command line argument parsing

- Struct tags and reflection in Go

- Byte offsets in string slicing

What was broken

### The separator's tail leaked into the value

A map flag with the tag sep:"=>" given -mkey=>val stored >val under key instead of val. splitKeyVal sliced the value from the separator's position plus one byte, so it only worked for the default = separator.

How we fixed it

### Skipping the separator's full length

splitKeyVal now skips len(sep) instead of one byte. A test covers the function itself and a map flag parsed through parseArgv with the => separator.

[#75](https://github.com/mkideal/cli/pull/75)

## Merged change

1 6 September 2026

- [01 #75Merged 6 September 2026 fix(flag): honor full separator length when splitting map key=value pairs](https://github.com/mkideal/cli/pull/75)

## What it taught us

A separator longer than one character needs an offset of its full length, or part of it stays in the value. We test such bugs at two levels: in the helper function and through the public API, the way a user calls it.

[More about this technology: Golang](https://vulcode.com/en/technologies/go)

## Other projects we write code for

- [**urfave/cli** Go · 24,329 stars A declarative Go package for building command line tools.](https://vulcode.com/en/opensource/contributions/urfave-cli)

- [**chezmoi** Go · 22,342 stars A dotfiles manager that keeps the same settings on many different machines, securely.](https://vulcode.com/en/opensource/contributions/chezmoi)

- [**goquery** Go · 14,995 stars A Go library for traversing and changing HTML documents in the style of jQuery, built on the golang.org/x/net/html parser.](https://vulcode.com/en/opensource/contributions/goquery)

- [**Ebitengine** Go · 13,647 stars A 2D game engine in Go, used in games released for computers, phones, browsers and consoles.](https://vulcode.com/en/opensource/contributions/ebiten)

- [**Fission** Go · 8,950 stars A serverless functions framework for Kubernetes that runs code as functions and scales them down to zero when they are idle.](https://vulcode.com/en/opensource/contributions/fission)

- [**Concourse** Go · 7,944 stars A container-based automation system written in Go and used mostly for CI/CD. Pipelines and tasks are described in YAML files.](https://vulcode.com/en/opensource/contributions/concourse)

## Describe your project.

A free quote comes back within an hour during working hours.

### Rather skip the form?

Ask in the chat or write to us directly.

Open the chat

- **Email**: [hello@vulcode.com](mailto:hello@vulcode.com)
- **Phone**: [+48 576 043 920](tel:+48576043920)
- **Discord**: [discord.gg/vulcode](https://discord.gg/vulcode)
