Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

ref(*): run golangci-lint run --fix #1595

Merged
merged 1 commit into from
Aug 20, 2020
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
1 change: 0 additions & 1 deletion ci/cmd/maestro.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ func main() {
}
}
}

}

// Targeting osm-controller specifically might be ok for now
Expand Down
2 changes: 0 additions & 2 deletions ci/cmd/maestro/kubernetes_tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,9 @@ func SearchLogsForSuccess(kubeClient kubernetes.Interface, namespace string, pod
defer logStream.Close()
r := bufio.NewReader(logStream)
for {

line, err := r.ReadString('\n')

switch {

// Make sure we don't wait too long for success/failure
case time.Since(startedWaiting) >= totalWait:
result <- TestsTimedOut
Expand Down
1 change: 0 additions & 1 deletion cmd/cli/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ type dashboardCmd struct {
}

func newDashboardCmd(config *action.Configuration, out io.Writer) *cobra.Command {

dash := &dashboardCmd{
out: out,
config: config,
Expand Down
6 changes: 3 additions & 3 deletions cmd/cli/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import (
"helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/strvals"

"github.com/openservicemesh/osm/pkg/cli"
"github.com/openservicemesh/osm/pkg/constants"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/validation"
"k8s.io/client-go/kubernetes"

"github.com/openservicemesh/osm/pkg/cli"
"github.com/openservicemesh/osm/pkg/constants"
)

const installDesc = `
Expand Down
10 changes: 5 additions & 5 deletions cmd/cli/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openservicemesh/osm/pkg/constants"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
fake "k8s.io/client-go/kubernetes/fake"

helm "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chartutil"
kubefake "helm.sh/helm/v3/pkg/kube/fake"
"helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/storage"
"helm.sh/helm/v3/pkg/storage/driver"
v1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
fake "k8s.io/client-go/kubernetes/fake"

"github.com/openservicemesh/osm/pkg/constants"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion cmd/cli/namespace_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import (
"fmt"
"io"

"github.com/openservicemesh/osm/pkg/constants"
"github.com/pkg/errors"
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes"

"github.com/openservicemesh/osm/pkg/constants"
)

const namespaceAddDescription = `
Expand Down
3 changes: 2 additions & 1 deletion cmd/cli/namespace_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import (
"fmt"
"io"

"github.com/openservicemesh/osm/pkg/constants"
"github.com/pkg/errors"
"github.com/spf13/cobra"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"

"github.com/openservicemesh/osm/pkg/constants"
)

const namespaceListDescription = `
Expand Down
3 changes: 2 additions & 1 deletion cmd/cli/namespace_remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import (
"fmt"
"io"

"github.com/openservicemesh/osm/pkg/constants"
"github.com/pkg/errors"
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes"

"github.com/openservicemesh/osm/pkg/constants"
)

const namespaceRemoveDescription = `
Expand Down
3 changes: 2 additions & 1 deletion cmd/cli/namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openservicemesh/osm/pkg/constants"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
fake "k8s.io/client-go/kubernetes/fake"

"github.com/openservicemesh/osm/pkg/constants"
)

var (
Expand Down
1 change: 0 additions & 1 deletion demo/cmd/bookbuyer/bookbuyer.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ func getBooksWrapper(wg *sync.WaitGroup) {
}

func main() {

go debugServer()

numConnections, err := strconv.Atoi(numConnectionsStr)
Expand Down
2 changes: 0 additions & 2 deletions demo/cmd/bookthief/bookthief.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ type handler struct {
func getIndex(w http.ResponseWriter, r *http.Request) {
renderTemplate(w)
fmt.Printf("%s; URL: %q; Count: %d\n", getIdentity(), html.EscapeString(r.URL.Path), booksStolen)

}

func getHandlers() []handler {
Expand Down Expand Up @@ -88,7 +87,6 @@ func debugServer() {
}

func main() {

go debugServer()

// The bookthief is not allowed to purchase books from the bookstore.
Expand Down
2 changes: 0 additions & 2 deletions demo/cmd/common/books.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ func GetBooks(participantName string, meshExpectedResponseCode int, egressExpect
startTime := time.Now()

for url := range urlSuccessMap {

// We only care about the response code of the HTTP call for the given URL
responseCode, identity := fetch(url)

Expand Down Expand Up @@ -172,7 +171,6 @@ func GetBooks(participantName string, meshExpectedResponseCode int, egressExpect
// Maestro will stop tailing logs.
fmt.Println(Success)
}

}

if previouslySucceeded && !succeeded {
Expand Down
1 change: 0 additions & 1 deletion pkg/catalog/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func NewMeshCatalog(namespaceController namespace.Controller, kubeClient kuberne

for _, announcementChannel := range sc.getAnnouncementChannels() {
sc.announcementChannels.Add(announcementChannel)

}

go sc.repeater()
Expand Down
2 changes: 0 additions & 2 deletions pkg/catalog/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ func (mc *MeshCatalog) getAllowedDirectionalServices(svc service.MeshService, di
// ListAllowedInboundServices lists the inbound services allowed to connect to the given service.
func (mc *MeshCatalog) ListAllowedInboundServices(destinationService service.MeshService) ([]service.MeshService, error) {
return mc.getAllowedDirectionalServices(destinationService, inbound)

}

// ListAllowedOutboundServices lists the services the given service is allowed outbound connections to.
Expand Down Expand Up @@ -275,7 +274,6 @@ func getTrafficPolicyPerRoute(mc *MeshCatalog, routePolicies map[trafficpolicy.T
if !matchFound {
log.Error().Msgf("TrafficTarget %s/%s could not find a TrafficSpec %s", trafficTargets.Namespace, trafficTargets.Name, specKey)
return nil, errNoTrafficSpecFoundForTrafficPolicy

}
if len(trafficTargetSpecs.Matches) == 0 {
// no match name provided, so routes are build for all matches in traffic spec
Expand Down
1 change: 0 additions & 1 deletion pkg/catalog/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
func (mc *MeshCatalog) GetServicesForServiceAccount(sa service.K8sServiceAccount) ([]service.MeshService, error) {
var services []service.MeshService
for _, provider := range mc.endpointsProviders {

// TODO (#88) : remove this provider check once we have figured out the service account story for azure vms
if provider.GetID() == constants.AzureProviderName {
continue
Expand Down
1 change: 0 additions & 1 deletion pkg/catalog/xds_certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func (mc *MeshCatalog) GetServicesFromEnvoyCertificate(cn certificate.CommonName
Name: svc.Name,
}
serviceList = append(serviceList, meshService)

}
return serviceList, nil
}
Expand Down
1 change: 1 addition & 0 deletions pkg/certificate/encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/openservicemesh/osm/pkg/certificate/pem"
)

Expand Down
1 change: 0 additions & 1 deletion pkg/certificate/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func getPrivateKeyFixture() *rsa.PrivateKey {
CRTValues: []rsa.CRTValue{},
},
}

}

func getX509CertFixture() *x509.Certificate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func (cm *CertManager) issue(cn certificate.CommonName, validityPeriod *time.Dur
return cert, nil
}

// NewCertManager will contruct a new certificate.Certificater implemented
// NewCertManager will construct a new certificate.Certificater implemented
// using Jetstack's cert-manager,
func NewCertManager(
ca certificate.Certificater,
Expand Down
4 changes: 2 additions & 2 deletions pkg/certificate/providers/certmanager/debugger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ var _ = Describe("Test cert-manager Debugger", func() {
}
It("lists all issued certificets", func() {
actual := cm.ListIssuedCertificates()
expeced := []certificate.Certificater{cert}
Expect(actual).To(Equal(expeced))
expected := []certificate.Certificater{cert}
Expect(actual).To(Equal(expected))
})
})
})
1 change: 1 addition & 0 deletions pkg/certificate/providers/keyvault/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package keyvault

import (
"github.com/Azure/azure-sdk-for-go/services/keyvault/v7.0/keyvault"

"github.com/openservicemesh/osm/pkg/logger"
)

Expand Down
1 change: 1 addition & 0 deletions pkg/certificate/providers/vault/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"

"github.com/hashicorp/vault/api"

"github.com/openservicemesh/osm/pkg/certificate"
)

Expand Down
1 change: 0 additions & 1 deletion pkg/debugger/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ type namespaces struct {

func (ds debugServer) getMonitoredNamespacesHandler() http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

var n namespaces
n.Namespaces = ds.meshCatalogDebugger.ListMonitoredNamespaces()

Expand Down
1 change: 0 additions & 1 deletion pkg/debugger/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func (ds debugServer) getOSMConfigHandler() http.Handler {

func (ds debugServer) getSMIPoliciesHandler() http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

var p policies
p.TrafficSplits, p.WeightedServices, p.ServiceAccounts, p.RouteGroups, p.TrafficTargets, p.Services = ds.meshCatalogDebugger.ListSMIPolicies()

Expand Down
1 change: 0 additions & 1 deletion pkg/debugger/port_forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,4 @@ func (ds debugServer) forwardPort(req portForward) {
if err = fw.ForwardPorts(); err != nil {
log.Error().Err(err)
}

}
6 changes: 2 additions & 4 deletions pkg/endpoint/providers/kube/client.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import (
"strings"

mapset "github.com/deckarep/golang-set"
k8s "github.com/openservicemesh/osm/pkg/kubernetes"
"github.com/openservicemesh/osm/pkg/service"

"github.com/pkg/errors"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
Expand All @@ -21,7 +18,9 @@ import (

"github.com/openservicemesh/osm/pkg/configurator"
"github.com/openservicemesh/osm/pkg/endpoint"
k8s "github.com/openservicemesh/osm/pkg/kubernetes"
"github.com/openservicemesh/osm/pkg/namespace"
"github.com/openservicemesh/osm/pkg/service"
)

// NewProvider implements mesh.EndpointsProvider, which creates a new Kubernetes cluster/compute provider.
Expand Down Expand Up @@ -103,7 +102,6 @@ func (c Client) ListEndpointsForService(svc service.MeshService) []endpoint.Endp
}
endpoints = append(endpoints, ept)
}

}
}
}
Expand Down
1 change: 0 additions & 1 deletion pkg/endpoint/providers/kube/fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

// NewFakeProvider implements mesh.EndpointsProvider, which creates a test Kubernetes cluster/compute provider.
func NewFakeProvider() endpoint.Provider {

return &fakeClient{
endpoints: map[string][]endpoint.Endpoint{
tests.BookstoreService.String(): {tests.Endpoint},
Expand Down
2 changes: 0 additions & 2 deletions pkg/envoy/ads/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func (s *Server) StreamAggregatedResources(server xds_discovery.AggregatedDiscov
go receive(requests, &server, proxy, quit)

for {

select {
case <-ctx.Done():
return nil
Expand Down Expand Up @@ -148,7 +147,6 @@ func (s *Server) StreamAggregatedResources(server xds_discovery.AggregatedDiscov
case <-proxy.GetAnnouncementsChannel():
log.Info().Msgf("Change detected - update all Envoys.")
s.sendAllResponses(proxy, &server, s.cfg)

}
}
}
1 change: 0 additions & 1 deletion pkg/envoy/lds/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func NewResponse(catalog catalog.MeshCataloger, proxy *envoy.Proxy, _ *xds_disco
// This proxy is fronting a service that is a backend for an ingress, add a FilterChain for it
ingressFilterChains := getIngressFilterChains(proxyServiceName, cfg)
inboundListener.FilterChains = append(inboundListener.FilterChains, ingressFilterChains...)

} else {
log.Trace().Msgf("There is no k8s Ingress for service %s", proxyServiceName)
}
Expand Down
1 change: 1 addition & 0 deletions pkg/envoy/lds/response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/envoyproxy/go-control-plane/pkg/wellknown"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/openservicemesh/osm/pkg/configurator"
"github.com/openservicemesh/osm/pkg/envoy"
"github.com/openservicemesh/osm/pkg/tests"
Expand Down
3 changes: 1 addition & 2 deletions pkg/envoy/lds/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ package lds
import (
xds_tracing "github.com/envoyproxy/go-control-plane/envoy/config/trace/v3"
xds_hcm "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3"

"github.com/golang/protobuf/ptypes"

"github.com/openservicemesh/osm/pkg/configurator"
"github.com/openservicemesh/osm/pkg/constants"
)

// GetZipkinTracingConfig returns a configuration tracing struct for a connection manager to use
func GetZipkinTracingConfig(cfg configurator.Configurator) (*xds_hcm.HttpConnectionManager_Tracing, error) {

zipkinConf := &xds_tracing.ZipkinConfig{
CollectorCluster: constants.EnvoyZipkinCluster,
CollectorEndpoint: cfg.GetZipkinEndpoint(),
Expand Down
5 changes: 2 additions & 3 deletions pkg/envoy/rds/response.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package rds

import (
set "github.com/deckarep/golang-set"
xds_route "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
xds_discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"

set "github.com/deckarep/golang-set"

"github.com/golang/protobuf/ptypes"

"github.com/openservicemesh/osm/pkg/catalog"
"github.com/openservicemesh/osm/pkg/configurator"
"github.com/openservicemesh/osm/pkg/envoy"
Expand Down
Loading