Skip to content

Commit

Permalink
Add comment for env
Browse files Browse the repository at this point in the history
  • Loading branch information
dearchap committed Nov 21, 2024
1 parent 2d02868 commit dcdab00
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions godoc-current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ type EnvValueSource interface {
IsFromEnv() bool
Key() string
}
EnvValueSource is to specifically detect env sources when printing help text

type ErrorFormatter interface {
Format(s fmt.State, verb rune)
Expand Down
1 change: 1 addition & 0 deletions testdata/godoc-v3.x.txt
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ type EnvValueSource interface {
IsFromEnv() bool
Key() string
}
EnvValueSource is to specifically detect env sources when printing help text

type ErrorFormatter interface {
Format(s fmt.State, verb rune)
Expand Down
4 changes: 3 additions & 1 deletion value_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ type ValueSource interface {
Lookup() (string, bool)
}

// EnvValueSource is to specifically detect env sources when
// printing help text
type EnvValueSource interface {
IsFromEnv() bool
Key() string
Expand All @@ -43,7 +45,7 @@ func (vsc *ValueSourceChain) EnvKeys() []string {
vals := []string{}

for _, src := range vsc.Chain {
if v, ok := src.(EnvValueSource); ok {
if v, ok := src.(EnvValueSource); ok && v.IsFromEnv() {
vals = append(vals, v.Key())
}
}
Expand Down

0 comments on commit dcdab00

Please sign in to comment.