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 golang lint issues #2866

Merged
merged 1 commit into from
Apr 19, 2023
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
4 changes: 2 additions & 2 deletions pkg/csrf/csrf.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2021-2022 The Tekton Authors
Copyright 2021-2023 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -74,7 +74,7 @@ func (cs *csrf) ServeHTTP(w http.ResponseWriter, r *http.Request) {
cs.h.ServeHTTP(w, r)
}

func unauthorizedHandler(w http.ResponseWriter, r *http.Request) {
func unauthorizedHandler(w http.ResponseWriter, _ *http.Request) {
http.Error(w, fmt.Sprintf("%s - %s",
http.StatusText(http.StatusForbidden), errorNoHeader),
http.StatusForbidden)
Expand Down
2 changes: 1 addition & 1 deletion pkg/endpoints/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type Properties struct {
// GetProperties is used to get the installed namespace for the Dashboard,
// the version of the Tekton Dashboard, the version of Tekton Pipelines,
// when one's in read-only mode and Tekton Triggers version (if Installed)
func (r Resource) GetProperties(response http.ResponseWriter, request *http.Request) {
func (r Resource) GetProperties(response http.ResponseWriter, _ *http.Request) {
pipelineNamespace := r.Options.GetPipelinesNamespace()
triggersNamespace := r.Options.GetTriggersNamespace()
dashboardVersion := r.GetDashboardVersion()
Expand Down
4 changes: 2 additions & 2 deletions pkg/endpoints/health.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2022 The Tekton Authors
Copyright 2019-2023 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -18,7 +18,7 @@ import (
)

// CheckHealth responds with a status code 200 signalling that the application can receive requests
func (r Resource) CheckHealth(response http.ResponseWriter, request *http.Request) {
func (r Resource) CheckHealth(response http.ResponseWriter, _ *http.Request) {
// A method here so there's scope for doing anything fancy e.g. checking anything else
response.WriteHeader(http.StatusOK)
}
14 changes: 5 additions & 9 deletions pkg/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ type Server struct {

type responder struct{}

func (r *responder) Error(w http.ResponseWriter, req *http.Request, err error) {
func (r *responder) Error(w http.ResponseWriter, _ *http.Request, err error) {
logging.Log.Errorf("Error while proxying request: %v", err)
http.Error(w, err.Error(), http.StatusInternalServerError)
}
Expand Down Expand Up @@ -126,17 +126,13 @@ func Register(r endpoints.Resource, cfg *rest.Config) (*Server, error) {
logging.Log.Info("Adding Kube API")
apiProxyPrefix := "/api/"
apisProxyPrefix := "/apis/"
proxyHandlerAPI, err := NewProxyHandler(apiProxyPrefix, cfg, 30*time.Second)
if err != nil {
return nil, err
}
proxyHandlerAPIs, err := NewProxyHandler(apisProxyPrefix, cfg, 30*time.Second)
proxyHandler, err := NewProxyHandler(cfg, 30*time.Second)
if err != nil {
return nil, err
}
mux := http.NewServeMux()
mux.Handle(apiProxyPrefix, proxyHandlerAPI)
mux.Handle(apisProxyPrefix, proxyHandlerAPIs)
mux.Handle(apiProxyPrefix, proxyHandler)
mux.Handle(apisProxyPrefix, proxyHandler)

logging.Log.Info("Adding Dashboard APIs")
registerWeb(r, mux)
Expand All @@ -149,7 +145,7 @@ func Register(r endpoints.Resource, cfg *rest.Config) (*Server, error) {
}

// NewProxyHandler creates an API proxy handler for the cluster
func NewProxyHandler(apiProxyPrefix string, cfg *rest.Config, keepalive time.Duration) (http.Handler, error) {
func NewProxyHandler(cfg *rest.Config, keepalive time.Duration) (http.Handler, error) {
host := cfg.Host
if !strings.HasSuffix(host, "/") {
host += "/"
Expand Down