Skip to content

Commit dcdab00

Browse files
committed
Add comment for env
1 parent 2d02868 commit dcdab00

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

godoc-current.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ type EnvValueSource interface {
595595
IsFromEnv() bool
596596
Key() string
597597
}
598+
EnvValueSource is to specifically detect env sources when printing help text
598599

599600
type ErrorFormatter interface {
600601
Format(s fmt.State, verb rune)

testdata/godoc-v3.x.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ type EnvValueSource interface {
595595
IsFromEnv() bool
596596
Key() string
597597
}
598+
EnvValueSource is to specifically detect env sources when printing help text
598599

599600
type ErrorFormatter interface {
600601
Format(s fmt.State, verb rune)

value_source.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ type ValueSource interface {
1717
Lookup() (string, bool)
1818
}
1919

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

4547
for _, src := range vsc.Chain {
46-
if v, ok := src.(EnvValueSource); ok {
48+
if v, ok := src.(EnvValueSource); ok && v.IsFromEnv() {
4749
vals = append(vals, v.Key())
4850
}
4951
}

0 commit comments

Comments
 (0)