diff --git a/CHANGELOG.md b/CHANGELOG.md index 61796c5..bff3b5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed + +- Config.Load now is concurrent-safe (#567). + ## [1.3.1] - 2024-09-09 ### Added diff --git a/config.go b/config.go index 5f78360..8494f44 100644 --- a/config.go +++ b/config.go @@ -65,7 +65,7 @@ func New(opts ...Option) *Config { // Load loads configuration from the given loader. // Each loader takes precedence over the loaders before it. // -// This method is concurrency-safe. +// This method is concurrent-safe. func (c *Config) Load(loader Loader) error { if loader == nil { return nil diff --git a/default.go b/default.go index 4011cb6..c1802b6 100644 --- a/default.go +++ b/default.go @@ -44,7 +44,7 @@ func Unmarshal(path string, target any) error { // The register function must be non-blocking and usually completes instantly. // If it requires a long time to complete, it should be executed in a separate goroutine. // -// This method is concurrency-safe. +// This method is concurrent-safe. func OnChange(onChange func(), paths ...string) { defaultConfig.Load().OnChange(func(*Config) { onChange() }, paths...) } diff --git a/watch.go b/watch.go index 2f0851f..ea89187 100644 --- a/watch.go +++ b/watch.go @@ -125,7 +125,7 @@ func (c *Config) Watch(ctx context.Context) error { //nolint:cyclop,funlen,gocog // The register function must be non-blocking and usually completes instantly. // If it requires a long time to complete, it should be executed in a separate goroutine. // -// This method is concurrency-safe. +// This method is concurrent-safe. func (c *Config) OnChange(onChange func(*Config), paths ...string) { if onChange == nil { return // Do nothing is onchange is nil.