diff options
| author | Shulhan <ms@kilabit.info> | 2022-04-16 01:36:20 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-04-16 18:32:36 +0700 |
| commit | 8947cc8b6a9751b3cae3d4d22fdf3ac154f77dfd (patch) | |
| tree | 7251c221bc3d4a324a6bdaca7a215d75bbb310ca /environment.go | |
| parent | dfc441b32458d204dae6498867f08e7da483c815 (diff) | |
| download | rescached-8947cc8b6a9751b3cae3d4d22fdf3ac154f77dfd.tar.xz | |
all: apply suggestions from linter
List of changes,
* Remove unused constants keyIsEnabled, keyIsSystem, and keyLastUpdated.
* Use the method String on instance of Duration instead of fmt.Sprintf.
* Replace any usage of io/ioutil package with its replacement.
* Check for error from calling Environment.init and Zone.Add.
* Prefix all returned error on hostsBlock.update method.
* Add "lint" task as part of default target, build.
Diffstat (limited to 'environment.go')
| -rw-r--r-- | environment.go | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/environment.go b/environment.go index b8f2729..a4d7923 100644 --- a/environment.go +++ b/environment.go @@ -36,9 +36,6 @@ const ( keyDohBehindProxy = "doh.behind_proxy" keyHostsBlock = "hosts_block" keyHTTPPort = "http.port" - keyIsEnabled = "is_enabled" - keyIsSystem = "is_system" - keyLastUpdated = "last_updated" keyListen = "listen" keyParent = "parent" keyWUIListen = "wui.listen" @@ -90,7 +87,7 @@ func LoadEnvironment(fileConfig string) (env *Environment, err error) { env.fileConfig = fileConfig if len(fileConfig) == 0 { - env.init() + _ = env.init() return env, nil } @@ -266,10 +263,8 @@ func (env *Environment) save(file string) (in *ini.Ini, err error) { in.Set(sectionNameDNS, subNameServer, keyDohBehindProxy, fmt.Sprintf("%t", env.ServerOptions.DoHBehindProxy)) - in.Set(sectionNameDNS, subNameServer, keyCachePruneDelay, - fmt.Sprintf("%s", env.ServerOptions.PruneDelay)) - in.Set(sectionNameDNS, subNameServer, keyCachePruneThreshold, - fmt.Sprintf("%s", env.ServerOptions.PruneThreshold)) + in.Set(sectionNameDNS, subNameServer, keyCachePruneDelay, env.ServerOptions.PruneDelay.String()) + in.Set(sectionNameDNS, subNameServer, keyCachePruneThreshold, env.ServerOptions.PruneThreshold.String()) return in, nil } |
