HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
spf13
pflag
Go2017–2026
spf13 / pflag

pflag

Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.

8Distinct people
9Mentions
0Explicit recommenders
2.8KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 12:54:37 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year9 dated mentions

Observed mentions: 2017-09-07 20:00:36 UTC to 2026-08-11 18:43:56 UTC.

0122017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20172018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC101
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC000
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC101
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC101
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC101
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC202
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC000
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC000
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC202
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC101

What Hacker News says

9 sources
The first rule of writing Go CLI tools that don’t drive users insane is to use “github.com/spf13/pflag” instead of the “flag” standard library package. Rather annoyingly that is often the only third party dependency required…
In -h –Help -help Help –? –?
Looks cool, but nothing much happens for me. I used brew to install go, then ran the following: % type -a go /usr/local/bin/go % cd tsukae % go get -d ./... go: downloading github.com/inconshreveable/mousetrap v1.0.0 % go run main.go o: downloading github.com/spf13/cobra v1.1.3 go: downloading github.com/gizak/termui/v3 v3.1.0 go: downloading github.com/mattn/go-runewidth v0.0.2 go: downloading github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d go: downloading github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 go: downloading github.com/spf13/pflag v1.0.5 ...a whole lot of usage information... ...but nothing useful (not a go person, so, YMMV).... Any ideas? FYI, % go version go version go1.16 darwin/amd64
In Show HN: Unix tool that visualizes shell commands usage
My impression is that nobody bothers with the Go flags package and most people use the POSIX compatible pflag [1] library for argument parsing, usually via the awsome cobra [2] cli framework. Or they just use viper [3] for both command line and general configuration handling. No point reinventing the wheel or trying to remember some weird non-standard quirks. [1] https://github.com/spf13/pflag [2] https://github.com/spf13/cobra [3] https://github.com/spf13/viper
In Conventions for Command Line Options
The Go standard library has most of what you need for basic API servers. However as has been stated here, some things are not worth spending time crafting yourself. Also for modern Docker/Kubernetes ops environments you need some additional infrastructure for table stakes. Here's my standard Nulladmin.com stack: Routing - https://github.com/go-chi/chi Command flags - https://github.com/spf13/pflag Config - https://github.com/spf13/viper Logging - https://github.com/Sirupsen/logrus Metrics - https://github.com/prometheus/client_golang/prometheus SQL helper - https://github.com/jmoiron/sqlx OpenTracing - https://github.com/opentracing/opentracing-go
In Ask HN: What Go framework for web API are you using in production?

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.