mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-09-09 03:01:16 +00:00
chore: linting improvements and catching false positives (#882)
* chore: linting improvements and catching false positives Signed-off-by: Alex Jones <alexsimonjones@gmail.com> * chore: linting improvements and catching false positives Signed-off-by: Alex Jones <alexsimonjones@gmail.com> * chore: linting improvements and catching false positives Signed-off-by: Alex Jones <alexsimonjones@gmail.com> * chore: increase linter time out Signed-off-by: Alex Jones <alexsimonjones@gmail.com> --------- Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
This commit is contained in:
@@ -14,13 +14,10 @@ limitations under the License.
|
||||
package server
|
||||
|
||||
import (
|
||||
json "encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
rpc "buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go/schema/v1/schemav1grpc"
|
||||
@@ -32,25 +29,26 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Port string
|
||||
MetricsPort string
|
||||
Backend string
|
||||
Key string
|
||||
Token string
|
||||
Output string
|
||||
maxConcurrency int
|
||||
Handler *handler
|
||||
Logger *zap.Logger
|
||||
metricsServer *http.Server
|
||||
listener net.Listener
|
||||
Port string
|
||||
MetricsPort string
|
||||
Backend string
|
||||
Key string
|
||||
Token string
|
||||
Output string
|
||||
Handler *handler
|
||||
Logger *zap.Logger
|
||||
metricsServer *http.Server
|
||||
listener net.Listener
|
||||
}
|
||||
|
||||
//nolint:unused
|
||||
type Health struct {
|
||||
Status string `json:"status"`
|
||||
Success int `json:"success"`
|
||||
Failure int `json:"failure"`
|
||||
}
|
||||
|
||||
//nolint:unused
|
||||
var health = Health{
|
||||
Status: "ok",
|
||||
Success: 0,
|
||||
@@ -106,21 +104,3 @@ func (s *Config) ServeMetrics() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Config) healthzHandler(w http.ResponseWriter, r *http.Request) {
|
||||
js, err := json.MarshalIndent(health, "", " ")
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
fmt.Fprint(w, string(js))
|
||||
}
|
||||
|
||||
func getBoolParam(param string) bool {
|
||||
b, err := strconv.ParseBool(strings.ToLower(param))
|
||||
if err != nil {
|
||||
// Handle error if conversion fails
|
||||
return false
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
Reference in New Issue
Block a user