Skip to content

Commit

Permalink
Merge pull request #112 from quay/rb/revup/master/rm-reflection
Browse files Browse the repository at this point in the history
chore: remove reflection zero type when zero value is known (PROJQUAY-6620)
  • Loading branch information
openshift-merge-bot[bot] authored Mar 7, 2024
2 parents e2effef + fe678d0 commit 85db6f5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
4 changes: 1 addition & 3 deletions pkg/client/quay/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
"io/ioutil"
"net/http"
"net/url"

"github.com/quay/quay-bridge-operator/pkg/utils"
)

type QuayClient struct {
Expand Down Expand Up @@ -172,7 +170,7 @@ func (c *QuayClient) newRequest(method, path string, body interface{}) (*http.Re
}

req, err := http.NewRequest(method, u.String(), buf)
if !utils.IsZeroOfUnderlyingType(c.AuthToken) {
if c.AuthToken != "" {
req.Header.Set("Authorization", "Bearer "+c.AuthToken)
}

Expand Down
5 changes: 0 additions & 5 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ package utils

import (
"fmt"
"reflect"

"github.com/quay/quay-bridge-operator/pkg/constants"
"github.com/quay/quay-bridge-operator/pkg/logging"
corev1 "k8s.io/api/core/v1"
)

func IsZeroOfUnderlyingType(x interface{}) bool {
return reflect.DeepEqual(x, reflect.Zero(reflect.TypeOf(x)).Interface())
}

func RemoveItemsFromSlice(s []string, r []string) []string {

for i, v := range s {
Expand Down

0 comments on commit 85db6f5

Please sign in to comment.