You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2024/08/05 14:21:36 UTC
(skywalking-infra-e2e) 01/03: Bump up to go 1.22
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch composev2
in repository https://gitbox.apache.org/repos/asf/skywalking-infra-e2e.git
commit 0bd9f90ad68263d7a381d26e1ec685835fb7234a
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Sat Aug 3 19:33:12 2024 +0800
Bump up to go 1.22
---
.golangci.yml | 20 ++++++--------------
commands/cleanup/cleanup.go | 2 +-
commands/root.go | 6 ++----
commands/run/run.go | 2 +-
commands/setup/setup.go | 2 +-
commands/trigger/trigger.go | 2 +-
commands/verify/verify.go | 2 +-
go.mod | 2 +-
internal/components/setup/compose.go | 13 +++++++------
internal/components/verifier/funcs.go | 2 +-
internal/util/k8s.go | 2 +-
11 files changed, 23 insertions(+), 32 deletions(-)
diff --git a/.golangci.yml b/.golangci.yml
index 1e9901e..b959a62 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -5,26 +5,26 @@
# 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
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
run:
tests: false
go: "1.18"
- skip-dirs:
+issues:
+ exclude-dirs:
- third-party
linters-settings:
- govet:
- check-shadowing: true
+ shadow: true
revive:
min-confidence: 0
gocyclo:
@@ -92,7 +92,6 @@ linters-settings:
linters:
enable:
- - deadcode
- dogsled
- dupl
- errcheck
@@ -114,14 +113,7 @@ linters:
- typecheck
- unconvert
- unused
- - varcheck
- whitespace
disable:
- - structcheck
- depguard
- nakedret
-
-service:
- golangci-lint-version: 1.20.x
- prepare:
- - echo "here I can run custom commands, but no preparation needed for this repo"
diff --git a/commands/cleanup/cleanup.go b/commands/cleanup/cleanup.go
index fdc5daa..24976f8 100644
--- a/commands/cleanup/cleanup.go
+++ b/commands/cleanup/cleanup.go
@@ -32,7 +32,7 @@ import (
var Cleanup = &cobra.Command{
Use: "cleanup",
Short: "",
- RunE: func(cmd *cobra.Command, args []string) error {
+ RunE: func(_ *cobra.Command, _ []string) error {
err := DoCleanupAccordingE2E()
if err != nil {
err = fmt.Errorf("[Cleanup] %s", err)
diff --git a/commands/root.go b/commands/root.go
index 31e3c8f..2268634 100644
--- a/commands/root.go
+++ b/commands/root.go
@@ -34,9 +34,7 @@ import (
"github.com/apache/skywalking-infra-e2e/internal/util"
)
-var (
- verbosity string
-)
+var verbosity string
// Root represents the base command when called without any subcommands
var Root = &cobra.Command{
@@ -45,7 +43,7 @@ var Root = &cobra.Command{
Version: version,
SilenceErrors: true,
SilenceUsage: true,
- PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
+ PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
config.ReadGlobalConfigFile()
level, err := logrus.ParseLevel(verbosity)
diff --git a/commands/run/run.go b/commands/run/run.go
index a304779..733de27 100644
--- a/commands/run/run.go
+++ b/commands/run/run.go
@@ -33,7 +33,7 @@ import (
var Run = &cobra.Command{
Use: "run",
Short: "",
- RunE: func(cmd *cobra.Command, args []string) error {
+ RunE: func(_ *cobra.Command, _ []string) error {
err := runAccordingE2E()
if err != nil {
return err
diff --git a/commands/setup/setup.go b/commands/setup/setup.go
index a932d4d..0d73aab 100644
--- a/commands/setup/setup.go
+++ b/commands/setup/setup.go
@@ -33,7 +33,7 @@ import (
var Setup = &cobra.Command{
Use: "setup",
Short: "",
- RunE: func(cmd *cobra.Command, args []string) error {
+ RunE: func(_ *cobra.Command, _ []string) error {
if err := util.CheckDockerDaemon(); err != nil {
return err
}
diff --git a/commands/trigger/trigger.go b/commands/trigger/trigger.go
index cb49b54..3c013fb 100644
--- a/commands/trigger/trigger.go
+++ b/commands/trigger/trigger.go
@@ -32,7 +32,7 @@ import (
var Trigger = &cobra.Command{
Use: "trigger",
- RunE: func(cmd *cobra.Command, args []string) error {
+ RunE: func(_ *cobra.Command, _ []string) error {
action, err := CreateTriggerAction()
if err != nil {
return fmt.Errorf("[Trigger] %v", err)
diff --git a/commands/verify/verify.go b/commands/verify/verify.go
index 794e4b4..ab5996b 100644
--- a/commands/verify/verify.go
+++ b/commands/verify/verify.go
@@ -51,7 +51,7 @@ func init() {
var Verify = &cobra.Command{
Use: "verify",
Short: "verify if the actual data match the expected data",
- RunE: func(cmd *cobra.Command, args []string) error {
+ RunE: func(_ *cobra.Command, _ []string) error {
if expected != "" {
return verifySingleCase(expected, actual, query)
}
diff --git a/go.mod b/go.mod
index 0a0f51a..457a549 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module github.com/apache/skywalking-infra-e2e
-go 1.18
+go 1.22
require (
github.com/docker/docker v20.10.7+incompatible
diff --git a/internal/components/setup/compose.go b/internal/components/setup/compose.go
index 7b799ae..a42b2ae 100644
--- a/internal/components/setup/compose.go
+++ b/internal/components/setup/compose.go
@@ -51,9 +51,7 @@ const (
SeparatorV2 = "-"
)
-var (
- containerNamePattern = regexp.MustCompile(`.*_(?P<containerNum>\d+)$`)
-)
+var containerNamePattern = regexp.MustCompile(`.*_(?P<containerNum>\d+)$`)
// ComposeSetup sets up environment according to e2e.yaml.
func ComposeSetup(e2eConfig *config.E2EConfig) error {
@@ -131,7 +129,8 @@ type ComposeService struct {
}
func exposeComposeService(services []*ComposeService, cli *client.Client,
- identity string, e2eConfig *config.E2EConfig) error {
+ identity string, e2eConfig *config.E2EConfig,
+) error {
dockerProvider := &DockerProvider{client: cli}
// find exported port and build env
@@ -163,7 +162,8 @@ func (c *ComposeService) FindContainer(cli *client.Client, identity string) (*ty
}
func exposeComposePort(dockerProvider *DockerProvider, service *ComposeService, cli *client.Client, identity string,
- e2eConfig *config.E2EConfig) error {
+ e2eConfig *config.E2EConfig,
+) error {
if len(service.waitStrategies) == 0 {
return nil
}
@@ -339,6 +339,7 @@ func waitPortUntilReady(e2eConfig *config.E2EConfig, container *types.Container,
target := &DockerContainer{
ID: container.ID,
WaitingFor: wait.NewHostPortStrategy(waitPort),
- provider: dockerProvider}
+ provider: dockerProvider,
+ }
return WaitPort(context.Background(), target, waitPort, waitTimeout)
}
diff --git a/internal/components/verifier/funcs.go b/internal/components/verifier/funcs.go
index f0ca3d4..369259c 100644
--- a/internal/components/verifier/funcs.go
+++ b/internal/components/verifier/funcs.go
@@ -77,7 +77,7 @@ func notEmpty(s interface{}) string {
return fmt.Sprintf("<%q is empty, wanted is not empty>", s)
}
if s, ok := s.(string); ok {
- if len(strings.TrimSpace(s)) > 0 {
+ if strings.TrimSpace(s) != "" {
return s
}
return fmt.Sprintf("<%q is empty, wanted is not empty>", s)
diff --git a/internal/util/k8s.go b/internal/util/k8s.go
index bbb9e64..0425989 100644
--- a/internal/util/k8s.go
+++ b/internal/util/k8s.go
@@ -146,7 +146,7 @@ func GetManifests(manifests string) (files []string, err error) {
switch mode := fi.Mode(); {
case mode.IsDir():
- err := filepath.Walk(f, func(path string, info os.FileInfo, err error) error {
+ err := filepath.Walk(f, func(path string, _ os.FileInfo, err error) error {
if err != nil {
return err
}