Skip to content

Commit 7291b04

Browse files
committed
minor cleanup based on make check
1 parent 9e5c5af commit 7291b04

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

api/auth.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func Authorize(username string, password string) (ok bool) {
2020
default:
2121
return false
2222
}
23-
if ok != true {
23+
if !ok {
2424
return false
2525
}
2626
}
@@ -67,7 +67,7 @@ func getGroups(c *gin.Context, username string) {
6767

6868
var groups []string
6969
config := context.Config()
70-
dn := fmt.Sprintf("%s", config.Auth.LdapDN)
70+
dn := config.Auth.LdapDN
7171
session := sessions.Default(c)
7272
// connect to ldap server
7373
server := fmt.Sprintf("%s", config.Auth.Server)
@@ -94,7 +94,6 @@ func getGroups(c *gin.Context, username string) {
9494
groups = append(groups, fmt.Sprintf("%s,", value))
9595
}
9696
session.Set("Groups", groups)
97-
return
9897
}
9998

10099
func checkGroup(c *gin.Context, ldgroup string) bool {

console/terminal.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package console
33
import (
44
"syscall"
55

6-
"golang.org/x/crypto/ssh/terminal"
6+
"golang.org/x/term"
77
)
88

99
// RunningOnTerminal checks whether stdout is terminal
1010
func RunningOnTerminal() bool {
11-
return terminal.IsTerminal(syscall.Stdout)
11+
return term.IsTerminal(syscall.Stdout)
1212
}

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ require (
4848
golang.org/x/crypto v0.0.0-20220313003712-b769efc7c000
4949
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
5050
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5
51+
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
5152
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65
5253
google.golang.org/protobuf v1.27.1 // indirect
5354
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c

pgp/internal.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"golang.org/x/crypto/openpgp/clearsign"
1919
openpgp_errors "golang.org/x/crypto/openpgp/errors"
2020
"golang.org/x/crypto/openpgp/packet"
21-
"golang.org/x/crypto/ssh/terminal"
21+
"golang.org/x/term"
2222
)
2323

2424
// Test interface
@@ -174,7 +174,7 @@ func (g *GoSigner) Init() error {
174174
for attempt := 0; attempt < 3; attempt++ {
175175
fmt.Print("\nEnter passphrase: ")
176176
var bytePassphrase []byte
177-
bytePassphrase, err = terminal.ReadPassword(int(syscall.Stdin))
177+
bytePassphrase, err = term.ReadPassword(int(syscall.Stdin))
178178
if err != nil {
179179
return errors.Wrap(err, "error reading passphare")
180180
}

0 commit comments

Comments
 (0)