From 0c9f1cc6545c0fbaf69833216910387674626a10 Mon Sep 17 00:00:00 2001 From: Bartlomiej Plotka Date: Fri, 29 Jan 2021 20:52:52 +0000 Subject: [PATCH] Fix. Signed-off-by: Bartlomiej Plotka --- Makefile | 2 +- core/go.sum | 4 ---- core/pkg/backoff/backoff.go | 3 +++ core/pkg/backoff/backoff_test.go | 3 +++ e2e/cli.go | 3 +++ e2e/composite_service.go | 3 +++ e2e/db/db.go | 3 +++ e2e/go.mod | 2 +- e2e/go.sum | 5 +++-- e2e/internal/matchers/matcher.go | 3 +++ e2e/internal/matchers/regexp.go | 3 +++ e2e/internal/s3/s3.go | 3 +++ e2e/metrics.go | 3 +++ e2e/scenario.go | 8 ++++++-- e2e/scenario_test.go | 3 +++ e2e/service.go | 9 ++++++--- e2e/service_test.go | 3 +++ 17 files changed, 50 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index b81e2ef..45016af 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,7 @@ lint: $(FAILLINT) $(GOLANGCI_LINT) $(MISSPELL) build format docs check-git deps $(call require_clean_work_tree,"detected not clean master before running lint - run make lint and commit changes.") @echo ">> verifying imported " for dir in $(MODULES) ; do \ - cd $${dir} && $(FAILLINT) -paths "fmt.{Print,PrintfPrintln,Sprint}" -ignore-tests ./...; && \ + cd $${dir} && $(FAILLINT) -paths "fmt.{Print,PrintfPrintln,Sprint}" -ignore-tests ./... && \ $(FAILLINT) -paths "github.com/stretchr/testify=github.com/efficientgo/tools/core/pkg/testutil" ./...; \ done @echo ">> examining all of the Go files" diff --git a/core/go.sum b/core/go.sum index f7759a5..aa414b2 100644 --- a/core/go.sum +++ b/core/go.sum @@ -13,8 +13,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -34,5 +32,3 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/core/pkg/backoff/backoff.go b/core/pkg/backoff/backoff.go index f32105e..deab524 100644 --- a/core/pkg/backoff/backoff.go +++ b/core/pkg/backoff/backoff.go @@ -1,3 +1,6 @@ +// Copyright (c) The EfficientGo Authors. +// Licensed under the Apache License 2.0. + package backoff // Copied from https://github.com/cortexproject/cortex/blob/0ec7b9664a01d538f1f49580b4c359a5c3cc755a/pkg/util/backoff.go diff --git a/core/pkg/backoff/backoff_test.go b/core/pkg/backoff/backoff_test.go index c209672..aaf11bc 100644 --- a/core/pkg/backoff/backoff_test.go +++ b/core/pkg/backoff/backoff_test.go @@ -1,3 +1,6 @@ +// Copyright (c) The EfficientGo Authors. +// Licensed under the Apache License 2.0. + package backoff // Copied from https://github.com/cortexproject/cortex/blob/0ec7b9664a01d538f1f49580b4c359a5c3cc755a/pkg/util/backoff.go diff --git a/e2e/cli.go b/e2e/cli.go index b999461..f4bf1ca 100644 --- a/e2e/cli.go +++ b/e2e/cli.go @@ -1,3 +1,6 @@ +// Copyright (c) The EfficientGo Authors. +// Licensed under the Apache License 2.0. + package e2e import ( diff --git a/e2e/composite_service.go b/e2e/composite_service.go index 1165d82..7eb0500 100644 --- a/e2e/composite_service.go +++ b/e2e/composite_service.go @@ -1,3 +1,6 @@ +// Copyright (c) The EfficientGo Authors. +// Licensed under the Apache License 2.0. + package e2e import ( diff --git a/e2e/db/db.go b/e2e/db/db.go index b6ffeed..55cf262 100644 --- a/e2e/db/db.go +++ b/e2e/db/db.go @@ -1,3 +1,6 @@ +// Copyright (c) The EfficientGo Authors. +// Licensed under the Apache License 2.0. + package e2edb import ( diff --git a/e2e/go.mod b/e2e/go.mod index 09aad1c..99519aa 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -3,7 +3,7 @@ module github.com/efficientgo/tools/e2e go 1.15 require ( - github.com/efficientgo/tools/core v0.0.0-20210129204550-29f654ba5ec3 + github.com/efficientgo/tools/core v0.0.0-20210129205121-421d0828c9a6 github.com/go-kit/kit v0.10.0 github.com/minio/minio-go/v7 v7.0.7 github.com/pkg/errors v0.9.1 diff --git a/e2e/go.sum b/e2e/go.sum index c93bdd2..33049bf 100644 --- a/e2e/go.sum +++ b/e2e/go.sum @@ -50,6 +50,8 @@ github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5m github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/efficientgo/tools/core v0.0.0-20210129205121-421d0828c9a6 h1:UMDR56yUMYNVtwMCL6DccrxuYBVDTRRHPWIb8bMa1tk= +github.com/efficientgo/tools/core v0.0.0-20210129205121-421d0828c9a6/go.mod h1:OmVcnJopJL8d3X3sSXTiypGoUSgFq1aDGmlrdi9dn/M= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= @@ -288,9 +290,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= diff --git a/e2e/internal/matchers/matcher.go b/e2e/internal/matchers/matcher.go index 815a953..0f673d6 100644 --- a/e2e/internal/matchers/matcher.go +++ b/e2e/internal/matchers/matcher.go @@ -1,3 +1,6 @@ +// Copyright (c) The EfficientGo Authors. +// Licensed under the Apache License 2.0. + // Copyright 2017 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/e2e/internal/matchers/regexp.go b/e2e/internal/matchers/regexp.go index 9529ddc..a0d21b9 100644 --- a/e2e/internal/matchers/regexp.go +++ b/e2e/internal/matchers/regexp.go @@ -1,3 +1,6 @@ +// Copyright (c) The EfficientGo Authors. +// Licensed under the Apache License 2.0. + // Copyright 2020 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/e2e/internal/s3/s3.go b/e2e/internal/s3/s3.go index b1f04b6..2e91539 100644 --- a/e2e/internal/s3/s3.go +++ b/e2e/internal/s3/s3.go @@ -1,3 +1,6 @@ +// Copyright (c) The EfficientGo Authors. +// Licensed under the Apache License 2.0. + // Copyright (c) The Thanos Authors. // Licensed under the Apache License 2.0. diff --git a/e2e/metrics.go b/e2e/metrics.go index 45ec6ae..b7fe4ab 100644 --- a/e2e/metrics.go +++ b/e2e/metrics.go @@ -1,3 +1,6 @@ +// Copyright (c) The EfficientGo Authors. +// Licensed under the Apache License 2.0. + package e2e import ( diff --git a/e2e/scenario.go b/e2e/scenario.go index 08e7a8d..bbcaf7a 100644 --- a/e2e/scenario.go +++ b/e2e/scenario.go @@ -1,3 +1,6 @@ +// Copyright (c) The EfficientGo Authors. +// Licensed under the Apache License 2.0. + package e2e import ( @@ -42,7 +45,7 @@ func (l *logger) Log(keyvals ...interface{}) error { b.WriteString(time.Now().Format("15:04:05")) for _, v := range keyvals { - b.WriteString(" " + fmt.Sprint(v)) + b.WriteString(" " + fmt.Sprintf("%v", v)) } b.WriteString("\n") @@ -260,6 +263,7 @@ func existDockerNetwork(logger log.Logger, networkName string) (bool, error) { if err != nil { logger.Log(string(out)) logger.Log("Unable to check if docker network", networkName, "exists:", err.Error()) + return false, err } return strings.TrimSpace(string(out)) != "", nil @@ -273,7 +277,7 @@ func getTempDirectory() (string, error) { dir string err error ) - // If a temp dir is referenced, return that + // If a temp dir is referenced, return that. if os.Getenv("E2E_TEMP_DIR") != "" { dir = os.Getenv("E2E_TEMP_DIR") } else { diff --git a/e2e/scenario_test.go b/e2e/scenario_test.go index 75b8b1d..fd0f99e 100644 --- a/e2e/scenario_test.go +++ b/e2e/scenario_test.go @@ -1,3 +1,6 @@ +// Copyright (c) The EfficientGo Authors. +// Licensed under the Apache License 2.0. + package e2e_test import ( diff --git a/e2e/service.go b/e2e/service.go index e28c14c..2d98787 100644 --- a/e2e/service.go +++ b/e2e/service.go @@ -1,3 +1,6 @@ +// Copyright (c) The EfficientGo Authors. +// Licensed under the Apache License 2.0. + package e2e import ( @@ -391,7 +394,7 @@ type ReadinessProbe interface { Ready(service *ConcreteService) (err error) } -// HTTPReadinessProbe checks readiness by making HTTP call and checking for expected HTTP status code +// HTTPReadinessProbe checks readiness by making HTTP call and checking for expected HTTP status code. type HTTPReadinessProbe struct { port int path string @@ -466,7 +469,7 @@ func (p *TCPReadinessProbe) Ready(service *ConcreteService) (err error) { return conn.Close() } -// CmdReadinessProbe checks readiness by `Exec`ing a command (within container) which returns 0 to consider status being ready +// CmdReadinessProbe checks readiness by `Exec`ing a command (within container) which returns 0 to consider status being ready. type CmdReadinessProbe struct { cmd *Command } @@ -525,7 +528,7 @@ func NewHTTPService( } func (s *HTTPService) Metrics() (_ string, err error) { - // Map the container port to the local port + // Map the container port to the local port. localPort := s.networkPortsContainerToLocal[s.httpPort] // Fetch metrics. diff --git a/e2e/service_test.go b/e2e/service_test.go index 2eecda5..2a2824f 100644 --- a/e2e/service_test.go +++ b/e2e/service_test.go @@ -1,3 +1,6 @@ +// Copyright (c) The EfficientGo Authors. +// Licensed under the Apache License 2.0. + package e2e import (