Skip to content

Commit

Permalink
Fix new golangci-lint errors (#2105)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmlewis committed Sep 27, 2021
1 parent f07b9cb commit b5776f9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
2 changes: 0 additions & 2 deletions github/orgs_packages_test.go
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
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
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
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
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

0 comments on commit b5776f9

Please sign in to comment.