Skip to content

Commit f83adf7

Browse files
author
Thomas Desveaux
committed
remove deprecated dependencies
1 parent ad2970c commit f83adf7

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

app/config.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package app
33
import (
44
"errors"
55
"fmt"
6+
"os"
7+
"path/filepath"
8+
69
"github.com/fsnotify/fsnotify"
710
log "github.com/sirupsen/logrus"
811
"github.com/spf13/viper"
9-
"os"
10-
"path/filepath"
1112
)
1213

1314
// Config represents the configuration of the server application.
@@ -111,7 +112,7 @@ func setDefaults() {
111112

112113
// AuthenticationNeeded returns whether users are defined and authentication is required
113114
func (cfg *Config) AuthenticationNeeded() bool {
114-
return cfg.Users != nil && len(cfg.Users) != 0
115+
return len(cfg.Users) != 0
115116
}
116117

117118
func (cfg *Config) handleConfigUpdate(e fsnotify.Event) {

app/config_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package app
33
import (
44
"bytes"
55
"encoding/json"
6-
"io/ioutil"
76
"os"
87
"path/filepath"
98
"reflect"
@@ -61,7 +60,7 @@ log:
6160
error: true
6261
`)
6362

64-
err := ioutil.WriteFile(filepath.Join(tmpDir, "config.yaml"), yamlCfg, 0600)
63+
err := os.WriteFile(filepath.Join(tmpDir, "config.yaml"), yamlCfg, 0600)
6564
if err != nil {
6665
t.Errorf("error writing test config. error = %v", err)
6766
}

app/fs.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ package app
22

33
import (
44
"context"
5-
log "github.com/sirupsen/logrus"
6-
"golang.org/x/net/webdav"
75
"os"
86
"path"
97
"path/filepath"
108
"strings"
9+
10+
log "github.com/sirupsen/logrus"
11+
"golang.org/x/net/webdav"
1112
)
1213

1314
// This file is an extension of golang.org/x/net/webdav/file.go.
@@ -32,7 +33,7 @@ func (d Dir) resolveUser(ctx context.Context) string {
3233
// achieved during the process, the BaseDir is used
3334
func (d Dir) resolve(ctx context.Context, name string) string {
3435
// This implementation is based on Dir.Open's code in the standard net/http package.
35-
if filepath.Separator != '/' && strings.IndexRune(name, filepath.Separator) >= 0 ||
36+
if filepath.Separator != '/' && strings.ContainsRune(name, filepath.Separator) ||
3637
strings.Contains(name, "\x00") {
3738
return ""
3839
}

cmd/davecli/subcmd/passwd.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package subcmd
22

33
import (
44
"fmt"
5-
"github.com/micromata/dave/app"
6-
"github.com/spf13/cobra"
7-
"golang.org/x/crypto/ssh/terminal"
85
"os"
96
"syscall"
7+
8+
"github.com/micromata/dave/app"
9+
"github.com/spf13/cobra"
10+
"golang.org/x/term"
1011
)
1112

1213
var passwdCmd = &cobra.Command{
@@ -30,7 +31,7 @@ var passwdCmd = &cobra.Command{
3031

3132
func readPassword() []byte {
3233
fmt.Print("Enter password: ")
33-
pw, err := terminal.ReadPassword(int(syscall.Stdin))
34+
pw, err := term.ReadPassword(int(syscall.Stdin))
3435
if err != nil {
3536
fmt.Printf("An error occurred reading the password: %s\n", err)
3637
os.Exit(1)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/spf13/viper v1.20.1
1111
golang.org/x/crypto v0.37.0
1212
golang.org/x/net v0.39.0
13+
golang.org/x/term v0.31.0
1314
)
1415

1516
require (
@@ -24,7 +25,6 @@ require (
2425
github.com/subosito/gotenv v1.6.0 // indirect
2526
go.uber.org/multierr v1.11.0 // indirect
2627
golang.org/x/sys v0.32.0 // indirect
27-
golang.org/x/term v0.31.0 // indirect
2828
golang.org/x/text v0.24.0 // indirect
2929
gopkg.in/yaml.v3 v3.0.1 // indirect
3030
)

0 commit comments

Comments
 (0)