From 935b2aa2ff0aea2675fecc23d8dd547826de1666 Mon Sep 17 00:00:00 2001 From: John Judd Date: Tue, 11 Jun 2024 10:36:21 -0500 Subject: [PATCH] fix lint issues --- backend/ftp/file_test.go | 4 ++-- backend/ftp/location_test.go | 2 +- backend/sftp/location_test.go | 2 +- utils/authority.go | 10 +++------- utils/authority_test.go | 2 +- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/backend/ftp/file_test.go b/backend/ftp/file_test.go index 9b928dc2..fbe4ddfe 100644 --- a/backend/ftp/file_test.go +++ b/backend/ftp/file_test.go @@ -1127,8 +1127,8 @@ func (ts *fileTestSuite) TestURI() { ts.Equal(expected, ts.testFile.URI(), "URI test") expected = "ftp://domain.com%5Cuser@host.com:22/some/path/to/file.txt" - fs := NewFileSystem() - f, err := fs.NewFile("domain.com%5Cuser@host.com:22", "/some/path/to/file.txt") + fsys := NewFileSystem() + f, err := fsys.NewFile("domain.com%5Cuser@host.com:22", "/some/path/to/file.txt") ts.NoError(err) ts.Equal(expected, f.URI(), "URI test") } diff --git a/backend/ftp/location_test.go b/backend/ftp/location_test.go index 1a33d8ec..71889758 100644 --- a/backend/ftp/location_test.go +++ b/backend/ftp/location_test.go @@ -324,7 +324,7 @@ func (lt *locationTestSuite) TestURI() { lt.Equal("ftp://user@host.com/blah/file.txt", file.URI(), "file uri with user, pass, host") authority = `domain.com\user@host.com` - 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") diff --git a/backend/sftp/location_test.go b/backend/sftp/location_test.go index c6f97d78..ae17f627 100644 --- a/backend/sftp/location_test.go +++ b/backend/sftp/location_test.go @@ -157,7 +157,7 @@ func (lt *locationTestSuite) TestURI() { lt.Equal("sftp://user@host.com/blah/file.txt", file.URI(), "file uri with user, pass, host") authority = `domain.com\user@host.com` - 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") diff --git a/utils/authority.go b/utils/authority.go index bd1005d5..1e6c712b 100644 --- a/utils/authority.go +++ b/utils/authority.go @@ -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 diff --git a/utils/authority_test.go b/utils/authority_test.go index ac32af11..d72a7255 100644 --- a/utils/authority_test.go +++ b/utils/authority_test.go @@ -24,7 +24,7 @@ type authorityTest struct { } func (a *authoritySuite) TestAuthority() { - tests := []authorityTest{ + tests := []*authorityTest{ { authorityString: "", host: "",