Add non-string slice env var support ([]int, []bool, etc.) #8
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
residual/config#8
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
env.go:95-103—setSliceonly handles[]stringslices. All other slice types ([]int,[]bool,[]float64) silently return nil:A user setting
MYAPP__PORTS=8080,8443,9090withPorts []intconf:"ports" envsep:","`` would get an empty slice with no error.Fix
Extend
setSliceto handle common element types:Files
core/env.go— extendsetSlicecore/env_test.go— add tests for[]int,[]bool,[]float64env varsTests