Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new golangci-lint errors #2105

Merged
merged 1 commit into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions github/orgs_packages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ func TestOrganizationsService_PackageDeleteVersion(t *testing.T) {

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Organizations.PackageDeleteVersion(ctx, "", "", "", 45763)

})
}

Expand All @@ -403,6 +402,5 @@ func TestOrganizationsService_PackageRestoreVersion(t *testing.T) {

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Organizations.PackageRestoreVersion(ctx, "", "", "", 45763)

})
}
4 changes: 0 additions & 4 deletions github/users_packages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,6 @@ func TestUsersService_Authenticated_PackageDeleteVersion(t *testing.T) {

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Users.PackageDeleteVersion(ctx, "", "", "", 45763)

})
}

Expand All @@ -648,7 +647,6 @@ func TestUsersService_specifiedUser_PackageDeleteVersion(t *testing.T) {

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Users.PackageDeleteVersion(ctx, "", "", "", 45763)

})
}

Expand All @@ -674,7 +672,6 @@ func TestUsersService_Authenticated_PackageRestoreVersion(t *testing.T) {

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Users.PackageRestoreVersion(ctx, "", "", "", 45763)

})
}

Expand All @@ -700,6 +697,5 @@ func TestUsersService_specifiedUser_PackageRestoreVersion(t *testing.T) {

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Users.PackageRestoreVersion(ctx, "", "", "", 45763)

})
}
2 changes: 0 additions & 2 deletions scrape/apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func Test_AppRestrictionsEnabled(t *testing.T) {
if want := tt.want; got != want {
t.Errorf("AppRestrictionsEnabled returned %t, want %t", got, want)
}

})
}
}
Expand Down Expand Up @@ -83,7 +82,6 @@ func Test_ListOAuthApps(t *testing.T) {
if !cmp.Equal(got, want) {
t.Errorf("ListOAuthApps(o) returned %v, want %v", got, want)
}

}

func Test_CreateApp(t *testing.T) {
Expand Down
12 changes: 6 additions & 6 deletions update-urls/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ func validateRewriteURLs(usedHelpers usedHelpersMap, endpointsByFilename endpoin
path = strings.ReplaceAll(path, "%s", "%v")

// Check the overrides.
endpoint.checkHttpMethodOverride(path)
endpoint.checkHTTPMethodOverride(path)

methodAndPath := fmt.Sprintf("%v %v", endpoint.httpMethod, path)
url, ok := docCache.UrlByMethodAndPath(methodAndPath)
url, ok := docCache.URLByMethodAndPath(methodAndPath)
if !ok {
if i := len(endpoint.endpointComments); i > 0 {
pos := fileRewriter.Position(endpoint.endpointComments[i-1].Pos())
Expand Down Expand Up @@ -529,7 +529,7 @@ func resolveHelpersAndCacheDocs(endpoints endpointsMap, docCache documentCacheWr
}

type documentCacheReader interface {
UrlByMethodAndPath(string) (string, bool)
URLByMethodAndPath(string) (string, bool)
}

type documentCacheWriter interface {
Expand All @@ -542,7 +542,7 @@ type documentCache struct {
urlByMethodAndPath map[string]string
}

func (dc *documentCache) UrlByMethodAndPath(methodAndPath string) (string, bool) {
func (dc *documentCache) URLByMethodAndPath(methodAndPath string) (string, bool) {
url, ok := dc.urlByMethodAndPath[methodAndPath]
return url, ok
}
Expand Down Expand Up @@ -657,7 +657,7 @@ func (e *Endpoint) String() string {
return b.String()
}

func (e *Endpoint) checkHttpMethodOverride(path string) {
func (e *Endpoint) checkHTTPMethodOverride(path string) {
lookupOverride := fmt.Sprintf("%v.%v: %v %v", e.serviceName, e.endpointName, e.httpMethod, path)
logf("Looking up override for %q", lookupOverride)
if v, ok := methodOverrides[lookupOverride]; ok {
Expand Down Expand Up @@ -747,7 +747,7 @@ func processAST(filename string, f *ast.File, services servicesMap, endpoints en
stdRefLines: stdRefLines,
endpointComments: endpointComments,
}
// ep.checkHttpMethodOverride("")
// ep.checkHTTPMethodOverride("")
endpoints[fullName] = ep
logf("endpoints[%q] = %#v", fullName, endpoints[fullName])
if ep.httpMethod == "" && (ep.helperMethod == "" || len(ep.urlFormats) == 0) {
Expand Down
6 changes: 3 additions & 3 deletions update-urls/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,21 +233,21 @@ type fakeDocCache struct {
endpoints endpointsByFragmentID
}

func (f *fakeDocCache) UrlByMethodAndPath(methodAndPath string) (string, bool) {
func (f *fakeDocCache) URLByMethodAndPath(methodAndPath string) (string, bool) {
f.t.Helper()
for fragmentID, endpoints := range f.endpoints {
for _, endpoint := range endpoints {
for _, urlFormat := range endpoint.urlFormats {
key := fmt.Sprintf("%v %v", endpoint.httpMethod, urlFormat)
if key == methodAndPath {
url := fmt.Sprintf("%v#%v", f.baseURL, fragmentID)
// log.Printf("UrlByMethodAndPath(%q) = (%q, true)", methodAndPath, url)
// log.Printf("URLByMethodAndPath(%q) = (%q, true)", methodAndPath, url)
return url, true
}
}
}
}
f.t.Fatalf("fakeDocCache.UrlByMethodAndPath: unable to find method %v", methodAndPath)
f.t.Fatalf("fakeDocCache.URLByMethodAndPath: unable to find method %v", methodAndPath)
return "", false
}

Expand Down