Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
funkyshu committed Jun 11, 2024
1 parent 9fdf005 commit 935b2aa
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions backend/ftp/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1127,8 +1127,8 @@ func (ts *fileTestSuite) TestURI() {
ts.Equal(expected, ts.testFile.URI(), "URI test")

expected = "ftp://domain.com%[email protected]:22/some/path/to/file.txt"
fs := NewFileSystem()
f, err := fs.NewFile("domain.com%[email protected]:22", "/some/path/to/file.txt")
fsys := NewFileSystem()
f, err := fsys.NewFile("domain.com%[email protected]:22", "/some/path/to/file.txt")
ts.NoError(err)
ts.Equal(expected, f.URI(), "URI test")
}
Expand Down
2 changes: 1 addition & 1 deletion backend/ftp/location_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ func (lt *locationTestSuite) TestURI() {
lt.Equal("ftp://[email protected]/blah/file.txt", file.URI(), "file uri with user, pass, host")

authority = `domain.com\[email protected]`
file, err = lt.ftpfs.NewFile(authority, "/blah/file.txt")
_, err = lt.ftpfs.NewFile(authority, "/blah/file.txt")
lt.Error(err)
lt.ErrorContains(err, "net/url: invalid userinfo", "file uri with bad user")

Expand Down
2 changes: 1 addition & 1 deletion backend/sftp/location_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (lt *locationTestSuite) TestURI() {
lt.Equal("sftp://[email protected]/blah/file.txt", file.URI(), "file uri with user, pass, host")

authority = `domain.com\[email protected]`
file, err = lt.sftpfs.NewFile(authority, "/blah/file.txt")
_, err = lt.sftpfs.NewFile(authority, "/blah/file.txt")
lt.Error(err)
lt.ErrorContains(err, "net/url: invalid userinfo", "file uri with bad user")

Expand Down
10 changes: 3 additions & 7 deletions utils/authority.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,11 @@ import (
pct-encoded = "%" HEXDIG HEXDIG
*/

// ------------------------------------ host :port
var portRegex = regexp.MustCompile(`(.*?)(?::(\d*))?$`)

// Authority represents host, port and userinfo (user/pass) in a URI
type Authority struct {
userinfo UserInfo
host string
port uint16
url *url.URL
host string
port uint16
url *url.URL
}

// UserInfo represents user/pass portion of a URI
Expand Down
2 changes: 1 addition & 1 deletion utils/authority_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type authorityTest struct {
}

func (a *authoritySuite) TestAuthority() {
tests := []authorityTest{
tests := []*authorityTest{
{
authorityString: "",
host: "",
Expand Down

0 comments on commit 935b2aa

Please sign in to comment.