We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8d0b592 commit 6f2f65dCopy full SHA for 6f2f65d
env/options.go
@@ -88,8 +88,16 @@ func (opts Options) getRawEnv(s string) string {
88
// - A new Options struct with the prefix set.
89
//
90
// See: https://pkg.go.dev/reflect#StructField
91
+//
92
+// Note: If a trailing underscore is not present, it will append one.
93
func (opts Options) withPrefix(sf reflect.StructField) Options {
94
opts.Prefix = opts.Prefix + sf.Tag.Get(PrefixEnv)
95
+
96
+ // Append an underscore if it's not already there.
97
+ if len(opts.Prefix) > 0 && opts.Prefix[len(opts.Prefix)-1] != '_' {
98
+ opts.Prefix = opts.Prefix + "_"
99
+ }
100
101
return opts
102
}
103
0 commit comments