mirror of
https://github.com/spf13/viper
synced 2024-12-22 11:37:02 +00:00
chore: run lint fixer
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
parent
ba606cd9f1
commit
41ec2aaf27
3 changed files with 11 additions and 10 deletions
2
viper.go
2
viper.go
|
@ -267,7 +267,7 @@ func New() *Viper {
|
|||
v := new(Viper)
|
||||
v.keyDelim = "."
|
||||
v.configName = "config"
|
||||
v.configPermissions = os.FileMode(0644)
|
||||
v.configPermissions = os.FileMode(0o644)
|
||||
v.fs = afero.NewOsFs()
|
||||
v.config = make(map[string]interface{})
|
||||
v.override = make(map[string]interface{})
|
||||
|
|
|
@ -263,13 +263,13 @@ func initDirs(t *testing.T) (string, string, func()) {
|
|||
require.Nil(t, err)
|
||||
|
||||
for _, dir := range testDirs {
|
||||
err = os.Mkdir(dir, 0750)
|
||||
err = os.Mkdir(dir, 0o750)
|
||||
assert.Nil(t, err)
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
path.Join(dir, config+".toml"),
|
||||
[]byte("key = \"value is "+dir+"\"\n"),
|
||||
0640)
|
||||
0o640)
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
|
@ -441,7 +441,7 @@ func TestReadInConfig(t *testing.T) {
|
|||
t.Run("config file set", func(t *testing.T) {
|
||||
fs := afero.NewMemMapFs()
|
||||
|
||||
err := fs.Mkdir("/etc/viper", 0777)
|
||||
err := fs.Mkdir("/etc/viper", 0o777)
|
||||
require.NoError(t, err)
|
||||
|
||||
file, err := fs.Create(testutil.AbsFilePath(t, "/etc/viper/config.yaml"))
|
||||
|
@ -2290,7 +2290,7 @@ func newViperWithConfigFile(t *testing.T) (*Viper, string, func()) {
|
|||
watchDir, err := ioutil.TempDir("", "")
|
||||
require.Nil(t, err)
|
||||
configFile := path.Join(watchDir, "config.yaml")
|
||||
err = ioutil.WriteFile(configFile, []byte("foo: bar\n"), 0640)
|
||||
err = ioutil.WriteFile(configFile, []byte("foo: bar\n"), 0o640)
|
||||
require.Nil(t, err)
|
||||
cleanup := func() {
|
||||
os.RemoveAll(watchDir)
|
||||
|
@ -2307,11 +2307,11 @@ func newViperWithSymlinkedConfigFile(t *testing.T) (*Viper, string, string, func
|
|||
watchDir, err := ioutil.TempDir("", "")
|
||||
require.Nil(t, err)
|
||||
dataDir1 := path.Join(watchDir, "data1")
|
||||
err = os.Mkdir(dataDir1, 0777)
|
||||
err = os.Mkdir(dataDir1, 0o777)
|
||||
require.Nil(t, err)
|
||||
realConfigFile := path.Join(dataDir1, "config.yaml")
|
||||
t.Logf("Real config file location: %s\n", realConfigFile)
|
||||
err = ioutil.WriteFile(realConfigFile, []byte("foo: bar\n"), 0640)
|
||||
err = ioutil.WriteFile(realConfigFile, []byte("foo: bar\n"), 0o640)
|
||||
require.Nil(t, err)
|
||||
cleanup := func() {
|
||||
os.RemoveAll(watchDir)
|
||||
|
@ -2355,7 +2355,7 @@ func TestWatchFile(t *testing.T) {
|
|||
})
|
||||
v.WatchConfig()
|
||||
// when overwriting the file and waiting for the custom change notification handler to be triggered
|
||||
err = ioutil.WriteFile(configFile, []byte("foo: baz\n"), 0640)
|
||||
err = ioutil.WriteFile(configFile, []byte("foo: baz\n"), 0o640)
|
||||
wg.Wait()
|
||||
// then the config value should have changed
|
||||
require.Nil(t, err)
|
||||
|
@ -2378,10 +2378,10 @@ func TestWatchFile(t *testing.T) {
|
|||
wg.Add(1)
|
||||
// when link to another `config.yaml` file
|
||||
dataDir2 := path.Join(watchDir, "data2")
|
||||
err := os.Mkdir(dataDir2, 0777)
|
||||
err := os.Mkdir(dataDir2, 0o777)
|
||||
require.Nil(t, err)
|
||||
configFile2 := path.Join(dataDir2, "config.yaml")
|
||||
err = ioutil.WriteFile(configFile2, []byte("foo: baz\n"), 0640)
|
||||
err = ioutil.WriteFile(configFile2, []byte("foo: baz\n"), 0o640)
|
||||
require.Nil(t, err)
|
||||
// change the symlink using the `ln -sfn` command
|
||||
err = exec.Command("ln", "-sfn", dataDir2, path.Join(watchDir, "data")).Run()
|
||||
|
|
1
watch.go
1
watch.go
|
@ -1,3 +1,4 @@
|
|||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package viper
|
||||
|
|
Loading…
Reference in a new issue