chore: run lint fixer

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
Mark Sagi-Kazar 2021-09-15 21:12:02 +02:00 committed by Márk Sági-Kazár
parent ba606cd9f1
commit 41ec2aaf27
3 changed files with 11 additions and 10 deletions

View file

@ -267,7 +267,7 @@ func New() *Viper {
v := new(Viper) v := new(Viper)
v.keyDelim = "." v.keyDelim = "."
v.configName = "config" v.configName = "config"
v.configPermissions = os.FileMode(0644) v.configPermissions = os.FileMode(0o644)
v.fs = afero.NewOsFs() v.fs = afero.NewOsFs()
v.config = make(map[string]interface{}) v.config = make(map[string]interface{})
v.override = make(map[string]interface{}) v.override = make(map[string]interface{})

View file

@ -263,13 +263,13 @@ func initDirs(t *testing.T) (string, string, func()) {
require.Nil(t, err) require.Nil(t, err)
for _, dir := range testDirs { for _, dir := range testDirs {
err = os.Mkdir(dir, 0750) err = os.Mkdir(dir, 0o750)
assert.Nil(t, err) assert.Nil(t, err)
err = ioutil.WriteFile( err = ioutil.WriteFile(
path.Join(dir, config+".toml"), path.Join(dir, config+".toml"),
[]byte("key = \"value is "+dir+"\"\n"), []byte("key = \"value is "+dir+"\"\n"),
0640) 0o640)
assert.Nil(t, err) assert.Nil(t, err)
} }
@ -441,7 +441,7 @@ func TestReadInConfig(t *testing.T) {
t.Run("config file set", func(t *testing.T) { t.Run("config file set", func(t *testing.T) {
fs := afero.NewMemMapFs() fs := afero.NewMemMapFs()
err := fs.Mkdir("/etc/viper", 0777) err := fs.Mkdir("/etc/viper", 0o777)
require.NoError(t, err) require.NoError(t, err)
file, err := fs.Create(testutil.AbsFilePath(t, "/etc/viper/config.yaml")) 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("", "") watchDir, err := ioutil.TempDir("", "")
require.Nil(t, err) require.Nil(t, err)
configFile := path.Join(watchDir, "config.yaml") 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) require.Nil(t, err)
cleanup := func() { cleanup := func() {
os.RemoveAll(watchDir) os.RemoveAll(watchDir)
@ -2307,11 +2307,11 @@ func newViperWithSymlinkedConfigFile(t *testing.T) (*Viper, string, string, func
watchDir, err := ioutil.TempDir("", "") watchDir, err := ioutil.TempDir("", "")
require.Nil(t, err) require.Nil(t, err)
dataDir1 := path.Join(watchDir, "data1") dataDir1 := path.Join(watchDir, "data1")
err = os.Mkdir(dataDir1, 0777) err = os.Mkdir(dataDir1, 0o777)
require.Nil(t, err) require.Nil(t, err)
realConfigFile := path.Join(dataDir1, "config.yaml") realConfigFile := path.Join(dataDir1, "config.yaml")
t.Logf("Real config file location: %s\n", realConfigFile) 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) require.Nil(t, err)
cleanup := func() { cleanup := func() {
os.RemoveAll(watchDir) os.RemoveAll(watchDir)
@ -2355,7 +2355,7 @@ func TestWatchFile(t *testing.T) {
}) })
v.WatchConfig() v.WatchConfig()
// when overwriting the file and waiting for the custom change notification handler to be triggered // 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() wg.Wait()
// then the config value should have changed // then the config value should have changed
require.Nil(t, err) require.Nil(t, err)
@ -2378,10 +2378,10 @@ func TestWatchFile(t *testing.T) {
wg.Add(1) wg.Add(1)
// when link to another `config.yaml` file // when link to another `config.yaml` file
dataDir2 := path.Join(watchDir, "data2") dataDir2 := path.Join(watchDir, "data2")
err := os.Mkdir(dataDir2, 0777) err := os.Mkdir(dataDir2, 0o777)
require.Nil(t, err) require.Nil(t, err)
configFile2 := path.Join(dataDir2, "config.yaml") 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) require.Nil(t, err)
// change the symlink using the `ln -sfn` command // change the symlink using the `ln -sfn` command
err = exec.Command("ln", "-sfn", dataDir2, path.Join(watchDir, "data")).Run() err = exec.Command("ln", "-sfn", dataDir2, path.Join(watchDir, "data")).Run()

View file

@ -1,3 +1,4 @@
//go:build !js
// +build !js // +build !js
package viper package viper