You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs.go
+9Lines changed: 9 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -174,6 +174,15 @@ the field should be ignored and no flag is declared. For example,
174
174
Host string `flag:"server_address"
175
175
GetsIgnored string `flag:""`
176
176
177
+
To help with organization, struct fields can be flattened such that the resolved flag name does not include the name of the struct itself. For example, this struct will accept the flags named simply `-host` and `-port`.
178
+
179
+
type struct Config {
180
+
NetworkConfig struct {
181
+
Host string
182
+
Port int
183
+
}
184
+
}
185
+
177
186
Environment variable naming and processing can be overridden with the `env:"name"` tag, where
178
187
the given name will be used exactly as the mapped environment variable name. If the WithEnv
179
188
or WithEnvRenamer options were enabled, a field can be excluded from environment variable
0 commit comments