mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 20:38:08 +08:00
Fix problems signaled by new linter version v1.45.2
PR (linter: upgrade linter version #405) triggered lint job which failed with many errors generated by various linters. Configurations were added to golangcilint.yaml and several refactorings were made in order to improve the results of the linter. maintidx linter disabled Signed-off-by: Alex Stan <alexandrustan96@yahoo.ro>
This commit is contained in:
committed by
Ramkumar Chinchani
parent
d19a4bf2a1
commit
d325c8b5f4
@@ -169,7 +169,7 @@ func IncDownloadCounter(ms MetricServer, repo string) {
|
||||
})
|
||||
}
|
||||
|
||||
func SetStorageUsage(ms MetricServer, rootDir string, repo string) {
|
||||
func SetStorageUsage(ms MetricServer, rootDir, repo string) {
|
||||
ms.SendMetric(func() {
|
||||
dir := path.Join(rootDir, repo)
|
||||
repoSize, err := getDirSize(dir)
|
||||
|
||||
@@ -235,7 +235,7 @@ func GetHistograms() map[string][]string {
|
||||
|
||||
// return true if a metric does not have any labels or if the label
|
||||
// values for searched metric corresponds to the one in the cached slice.
|
||||
func isMetricMatch(lValues []string, metricValues []string) bool {
|
||||
func isMetricMatch(lValues, metricValues []string) bool {
|
||||
if len(lValues) == len(metricValues) {
|
||||
for i, v := range metricValues {
|
||||
if v != lValues[i] {
|
||||
@@ -400,7 +400,7 @@ func (ms *metricServer) HistogramObserve(hv *HistogramValue) {
|
||||
}
|
||||
|
||||
// nolint: goerr113
|
||||
func sanityChecks(name string, knownLabels []string, found bool, labelNames []string, labelValues []string) error {
|
||||
func sanityChecks(name string, knownLabels []string, found bool, labelNames, labelValues []string) error {
|
||||
if !found {
|
||||
return fmt.Errorf("metric %s: not found", name)
|
||||
}
|
||||
@@ -479,7 +479,7 @@ func IncUploadCounter(ms MetricServer, repo string) {
|
||||
ms.SendMetric(uCounter)
|
||||
}
|
||||
|
||||
func SetStorageUsage(ms MetricServer, rootDir string, repo string) {
|
||||
func SetStorageUsage(ms MetricServer, rootDir, repo string) {
|
||||
dir := path.Join(rootDir, repo)
|
||||
|
||||
repoSize, err := getDirSize(dir)
|
||||
|
||||
@@ -38,7 +38,7 @@ type MetricsClient struct {
|
||||
}
|
||||
|
||||
func newHTTPMetricsClient() *http.Client {
|
||||
defaultTransport := http.DefaultTransport.(*http.Transport).Clone()
|
||||
defaultTransport := http.DefaultTransport.(*http.Transport).Clone() //nolint: forcetypeassert
|
||||
defaultTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} //nolint: gosec
|
||||
|
||||
return &http.Client{
|
||||
|
||||
Reference in New Issue
Block a user