Skip to content

Commit f4d620f

Browse files
committed
move history to its own section of the README
1 parent 93ac7e0 commit f4d620f

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

README.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
[![codecov](https://codecov.io/github/fortio/dflag/branch/main/graph/badge.svg?token=LONYZDFQ7C)](https://codecov.io/github/fortio/dflag)
2-
3-
This came from https://github.com/ldemailly/go-flagz, a fork of the code originally on https://github.com/mwitkow/go-flagz and https://github.com/improbable-eng/go-flagz with initial changes to get the go modules to work, reduce boiler plate needed for configmap watcher, avoid panic when there is extra whitespace, make the watcher work with regular files and relative paths and switched to standard golang flags.
4-
And now further changes, simplification, etc... as part of fortio.
5-
And then moved to a toplevel package in the fortio org.
6-
7-
Thanks to [@mwitkow](https://github.com/mwitkow) for having created this originally.
8-
9-
# Fortio Dynamic Flags (was Go FlagZ)
10-
112
[![Apache 2.0 License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
123

4+
# Fortio Dynamic Flags
5+
136
Dynamic, thread-safe `flag` variables that can be modified at runtime through files, URL endpoint,
147
or [Kubernetes](http://kubernetes.io) configmap changes.
158

16-
For a similar project for JVM languages (Java, scala) see [java-flagz](https://github.com/mwitkow/java-flagz)
17-
18-
Now rewritten and simplified and extended thanks to Go 1.18 generics (use versions prior to 1.33 if you want to use the older per type implementation)
9+
See History section below.
1910

2011
## This sounds crazy. Why?
2112

@@ -32,7 +23,8 @@ All of this can be done simultaneously across a whole shard of your services.
3223
## Features
3324

3425
* compatible with standard go `flag` package
35-
* dynamic `flag` that are thread-safe and efficient, now also `Dyn[T]` generic:
26+
* dynamic `flag` that are thread-safe and efficient
27+
- `Dyn[T]` generic, or
3628
- `DynBool`
3729
- `DynInt64`
3830
- `DynFloat64`
@@ -55,7 +47,6 @@ Here's a teaser of the debug endpoint:
5547

5648
Declare a single `flag.FlagSet` in some public package (e.g. `common.SharedFlagSet`) that you'll use throughout your server or stick to `flag.CommandLine` default flagset for your binary.
5749

58-
5950
### Dynamic JSON flag with a validator and notifier
6051

6152
```go
@@ -88,20 +79,36 @@ func MyHandler(resp http.ResponseWriter, req *http.Request) {
8879
```
8980

9081
All access to `featuresFlag`, which is a `[]string` flag, is synchronized across go-routines using `atomic` pointer swaps.
82+
9183
## Library versus caller style
84+
NEW:
9285

9386
```golang
9487
// In the library "libfoo" package
95-
var MyConfig = dflag.New("default value", "explanation of what that is for").WithValidator(MyValidator)
88+
var MyConfig = dflag.New("default value", "explanation of what that is for").WithValidator(myValidator)
9689
// In the caller/users, bind to an actual flag:
9790
dflag.Flag("foocfg", libfoo.MyConfig) // defines -foocfg flag
9891
```
9992

10093
## Complete example
10194

102-
See a [http server](examples/server_kube) complete example.
95+
See a [http server](examples/server_kube) complete example or the [fortio.org/scli](https://github.com/fortio/scli#scli) package for easy reuse/configuration.
96+
97+
## History
98+
99+
This came from https://github.com/ldemailly/go-flagz, a fork of the code originally on https://github.com/mwitkow/go-flagz and https://github.com/improbable-eng/go-flagz with initial changes to get the go modules to work, reduce boiler plate needed for configmap watcher, avoid panic when there is extra whitespace, make the watcher work with regular files and relative paths and switched to standard golang flags.
100+
101+
And further changes, simplification, etc... as part of fortio.
102+
103+
Including rewrite and simplifications taking advantage of go 1.18 and newer generics support (use versions in fortio prior to 1.33 if you want to use the older per type implementation)
104+
105+
And now moved to a toplevel package in the fortio org.
106+
107+
For a similar project for JVM languages (Java, scala) see [java-flagz](https://github.com/mwitkow/java-flagz)
108+
109+
Thanks to [@mwitkow](https://github.com/mwitkow) for having created this originally.
103110

104-
# Status
111+
## Status
105112

106113
This code is *production* quality. It's been running happily in production in its earlier incarnation at Improbable for years and now everywhere fortio runs.
107114

0 commit comments

Comments
 (0)