Skip to content

Commit

Permalink
chore: bump go (#2285)
Browse files Browse the repository at this point in the history
chore: replace utils with builtins
  • Loading branch information
cgrinds authored Aug 14, 2023
1 parent 4892c01 commit de3080b
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build, Test, Lint License

env:
GO_VERSION: "1.20.7"
GO_VERSION: "1.21.0"

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.20.7'
go-version: '1.21.0'
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
###############################################################################
SHELL := /bin/bash
GCC_EXISTS := $(shell which gcc)
REQUIRED_GO_VERSION := 1.20
REQUIRED_GO_VERSION := 1.21
ifneq (, $(shell which go))
FOUND_GO_VERSION := $(shell go version | cut -d" " -f3 | cut -d"o" -f 2)
CORRECT_GO_VERSION := $(shell expr `go version | cut -d" " -f3 | cut -d"o" -f 2` \>= ${REQUIRED_GO_VERSION})
Expand Down
16 changes: 8 additions & 8 deletions cmd/collectors/ems/ems_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"github.com/netapp/harvest/v2/pkg/conf"
"github.com/netapp/harvest/v2/pkg/tree"
"github.com/netapp/harvest/v2/pkg/tree/node"
"github.com/netapp/harvest/v2/pkg/util"
"github.com/rs/zerolog/log"
"os"
"slices"
"testing"
"time"
)
Expand Down Expand Up @@ -90,7 +90,7 @@ func (e *Ems) testBookendIssuingEms(t *testing.T, path string) {
// Check and evaluate ems events
var notGeneratedEmsNames []string
for generatedEmsName, mx := range e.Matrix {
if util.Contains(issuingEmsNames, generatedEmsName) {
if slices.Contains(issuingEmsNames, generatedEmsName) {
metr, ok := mx.GetMetrics()["events"]
if !ok {
t.Fatalf("Failed to get netric for Ems %s", generatedEmsName)
Expand Down Expand Up @@ -129,7 +129,7 @@ func (e *Ems) testBookendResolvingEms(t *testing.T, path string) {
// Check and evaluate ems events
var notResolvedEmsNames []string
for generatedEmsName, mx := range e.Matrix {
if util.Contains(issuingEmsNames, generatedEmsName) {
if slices.Contains(issuingEmsNames, generatedEmsName) {
metr, ok := mx.GetMetrics()["events"]
if !ok {
t.Fatalf("Failed to get netric for Ems %s", generatedEmsName)
Expand Down Expand Up @@ -169,7 +169,7 @@ func (e *Ems) testAutoResolvingEms(t *testing.T, path string) {

// Check and evaluate ems events
for generatedEmsName, mx := range e.Matrix {
if util.Contains(autoresolveEmsNames, generatedEmsName) {
if slices.Contains(autoresolveEmsNames, generatedEmsName) {
if metr, ok := mx.GetMetrics()["events"]; ok {
for _, instance := range mx.GetInstances() {
// If value not exist for that instance or metric value 0 indicate ems hasn't been raised.
Expand All @@ -191,7 +191,7 @@ func (e *Ems) testAutoResolvingEms(t *testing.T, path string) {
e.updateMatrix(time.Now().Add(1 * time.Second))
// Check and evaluate bookend ems events got auto resolved successfully.
for generatedEmsName, mx := range e.Matrix {
if util.Contains(autoresolveEmsNames, generatedEmsName) {
if slices.Contains(autoresolveEmsNames, generatedEmsName) {
if metr, ok := mx.GetMetrics()["events"]; ok {
for _, instance := range mx.GetInstances() {
// If value not exist for that instance or metric value 0 indicate ems hasn't been raised.
Expand All @@ -204,7 +204,7 @@ func (e *Ems) testAutoResolvingEms(t *testing.T, path string) {
}
}
}
if util.Contains(notAutoResolvedEmsNames, "LUN.offline") {
if slices.Contains(notAutoResolvedEmsNames, "LUN.offline") {
t.Fatalf("These Bookend Ems haven't been auto resolved: %s", notAutoResolvedEmsNames)
}

Expand All @@ -217,7 +217,7 @@ func (e *Ems) testAutoResolvingEms(t *testing.T, path string) {
t.Fatalf("These Bookend Ems haven't been removed from cache: %s", "LUN.offline")
}
for generatedEmsName, mx := range e.Matrix {
if util.Contains(autoresolveEmsNames, generatedEmsName) {
if slices.Contains(autoresolveEmsNames, generatedEmsName) {
if metr, ok := mx.GetMetrics()["events"]; ok {
for _, instance := range mx.GetInstances() {
// If value not exist for that instance or metric value 0 indicate ems hasn't been raised.
Expand All @@ -230,7 +230,7 @@ func (e *Ems) testAutoResolvingEms(t *testing.T, path string) {
}
}
}
if util.Contains(notAutoResolvedEmsNames, "monitor.fan.critical") {
if slices.Contains(notAutoResolvedEmsNames, "monitor.fan.critical") {
t.Fatalf("These Bookend Ems haven't been auto resolved: %s", notAutoResolvedEmsNames)
}
}
6 changes: 3 additions & 3 deletions cmd/tools/doctor/restZapiDiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package doctor

import (
"fmt"
"github.com/netapp/harvest/v2/pkg/util"
"github.com/tidwall/gjson"
"io"
"log"
Expand All @@ -11,6 +10,7 @@ import (
"os"
"path/filepath"
"regexp"
"slices"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -520,7 +520,7 @@ func labelValueDiff(label string, labelNames []string) {
results = gjson.GetMany(data, prefixLabelsName...)
}

if util.Contains([]string{"shelf_voltage_labels", "shelf_temperature_labels", "shelf_sensor_labels"}, label) {
if slices.Contains([]string{"shelf_voltage_labels", "shelf_temperature_labels", "shelf_sensor_labels"}, label) {
keyIndexes = append(keyIndexes, IndexOf(finalLabelNames, "shelf"))
keyIndexes = append(keyIndexes, IndexOf(finalLabelNames, "sensor_id"))
dataCenterIndex = IndexOf(finalLabelNames, "datacenter")
Expand All @@ -533,7 +533,7 @@ func labelValueDiff(label string, labelNames []string) {
results = gjson.GetMany(data, prefixLabelsName...)
}

if util.Contains([]string{"svm_labels", "security_login_labels"}, label) {
if slices.Contains([]string{"svm_labels", "security_login_labels"}, label) {
keyIndexes = append(keyIndexes, IndexOf(finalLabelNames, "svm"))
dataCenterIndex = IndexOf(finalLabelNames, "datacenter")
results = gjson.GetMany(data, prefixLabelsName...)
Expand Down
6 changes: 3 additions & 3 deletions cmd/tools/grafana/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package grafana

import (
"fmt"
"github.com/netapp/harvest/v2/pkg/util"
"github.com/tidwall/gjson"
"github.com/tidwall/pretty"
"os"
"path/filepath"
"regexp"
"slices"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -83,7 +83,7 @@ func checkThreshold(t *testing.T, path string, data []byte) {
isThresholdSet = color.String() == th[0] && v.String() == th[1]
} else if id == "custom.displayMode" && kind == "table" {
v := propertiesN.Get("value")
if !util.Contains(expectedColorBackground[kind], v.String()) {
if !slices.Contains(expectedColorBackground[kind], v.String()) {
t.Errorf("dashboard=%s panel=%s kind=%s expr=%s don't have correct displaymode expected %s found %s", path, panelTitle, kind, expr, expectedColorBackground[kind], v.String())
} else {
isColorBackgroundSet = true
Expand All @@ -94,7 +94,7 @@ func checkThreshold(t *testing.T, path string, data []byte) {

if kind == "stat" {
colorMode := value.Get("options.colorMode")
if !util.Contains(expectedColorBackground[kind], colorMode.String()) {
if !slices.Contains(expectedColorBackground[kind], colorMode.String()) {
t.Errorf("dashboard=%s panel=%s kind=%s expr=%s don't have correct colorMode expected %s found %s", path, panelTitle, kind, expr, expectedColorBackground[kind], colorMode.String())
} else {
isColorBackgroundSet = true
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/netapp/harvest/v2

go 1.20
go 1.21

require (
dario.cat/mergo v1.0.0
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFF
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
Expand Down
2 changes: 1 addition & 1 deletion integration/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pipeline {
environment {
BUILD_ID="dontKillMe"
JENKINS_NODE_COOKIE="dontKillMe"
GO_VERSION = "1.20.7"
GO_VERSION = "1.21.0"
}

stages {
Expand Down
18 changes: 9 additions & 9 deletions integration/go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module github.com/Netapp/harvest-automation

go 1.20
go 1.21

replace github.com/netapp/harvest/v2 => ../

require (
github.com/carlmjohnson/requests v0.23.4
github.com/netapp/harvest/v2 v2.0.0-20230404163343-f21b0c1a08ac
github.com/rs/zerolog v1.29.1
github.com/tidwall/gjson v1.14.4
golang.org/x/text v0.11.0
github.com/netapp/harvest/v2 v2.0.0-20230811164902-1b91e21d6950
github.com/rs/zerolog v1.30.0
github.com/tidwall/gjson v1.16.0
golang.org/x/text v0.12.0
)

require (
Expand All @@ -21,16 +21,16 @@ require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect
github.com/shirou/gopsutil/v3 v3.23.6 // indirect
github.com/shirou/gopsutil/v3 v3.23.7 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/sys v0.11.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
29 changes: 15 additions & 14 deletions integration/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b h1:0LFwY6Q3gMACTjAbMZBjXAqTOzOwFaj2Ld6cjeQ7Rig=
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc=
github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c=
github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shirou/gopsutil/v3 v3.23.6 h1:5y46WPI9QBKBbK7EEccUPNXpJpNrvPuTD0O2zHEHT08=
github.com/shirou/gopsutil/v3 v3.23.6/go.mod h1:j7QX50DrXYggrpN30W0Mo+I4/8U2UUIQrnrhqUeWrAU=
github.com/shirou/gopsutil/v3 v3.23.7 h1:C+fHO8hfIppoJ1WdsVm1RoI0RwXoNdfTK7yWXV0wVj4=
github.com/shirou/gopsutil/v3 v3.23.7/go.mod h1:c4gnmoRC0hQuaLqvxnx1//VXQ0Ms/X9UnJF8pddY5z4=
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
Expand All @@ -54,22 +54,23 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM=
github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.16.0 h1:SyXa+dsSPpUlcwEDuKuEBJEz5vzTvOea+9rjyYodQFg=
github.com/tidwall/gjson v1.16.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM=
github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI=
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4=
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand All @@ -78,11 +79,11 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
2 changes: 1 addition & 1 deletion jenkins/artifacts/jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pipeline {
jfrogImagePrefix = "netappdownloads.jfrog.io/oss-docker-harvest-production/harvest"
jfrogRepo = "netappdownloads.jfrog.io"
COMMIT_ID = sh(returnStdout: true, script: 'git rev-parse HEAD')
GO_VERSION = "1.20.7"
GO_VERSION = "1.21.0"
}

stages {
Expand Down
7 changes: 4 additions & 3 deletions pkg/tree/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"fmt"
"github.com/netapp/harvest/v2/pkg/util"
"regexp"
"slices"
"strings"
)

Expand Down Expand Up @@ -326,7 +327,7 @@ func (n *Node) Merge(subtemplate *Node, skipOverwrite []string) {
} else if mine == nil {
n.AddChild(child)
} else {
if mine.GetParent() != nil && util.Contains(skipOverwrite, mine.GetParent().GetNameS()) {
if mine.GetParent() != nil && slices.Contains(skipOverwrite, mine.GetParent().GetNameS()) {
mine.SetContentS(mine.GetContentS() + "," + child.GetContentS())
} else {
mine.SetContentS(child.GetContentS())
Expand Down Expand Up @@ -418,7 +419,7 @@ func (n *Node) SearchContent(prefix []string, paths [][]string) ([]string, bool)
}
//fmt.Printf(" -> current_path=%v \t new_path=%v\n", currentPath, newPath)
for _, path := range paths {
if util.EqualStringSlice(newPath, path) {
if slices.Equal(newPath, path) {
matches = append(matches, node.GetContentS())
//fmt.Println(" MATCH!")
break
Expand Down Expand Up @@ -451,7 +452,7 @@ func (n *Node) SearchChildren(path []string) []*Node {
newPath = make([]string, len(currentPath))
copy(newPath, currentPath)
}
if util.EqualStringSlice(newPath, path) {
if slices.Equal(newPath, path) {
matches = append(matches, node)
} else if len(newPath) < len(path) {
for _, child := range node.GetChildren() {
Expand Down
Loading

0 comments on commit de3080b

Please sign in to comment.