From 682a9cf8eb6723f8b22598be38939484b127bf71 Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Thu, 28 May 2020 15:59:59 -0400 Subject: [PATCH 1/8] Switch to go 1.14.3. --- .ci/scripts/install-tools.bat | 2 +- .go-version | 2 +- Jenkinsfile | 2 +- auditbeat/Dockerfile | 2 +- auditbeat/make.bat | 2 +- dev-tools/mage/build.go | 10 ---------- dev-tools/mage/common.go | 9 ++------- dev-tools/mage/crossbuild.go | 3 --- dev-tools/mage/dashboard.go | 2 +- dev-tools/mage/fields.go | 24 ++++++----------------- dev-tools/mage/fmt.go | 17 ++++------------ dev-tools/mage/install.go | 16 +-------------- dev-tools/mage/integtest.go | 3 --- dev-tools/mage/settings.go | 5 ----- dev-tools/make/mage-install.mk | 2 +- dev-tools/packaging/packages.yml | 4 ++-- filebeat/Dockerfile | 2 +- filebeat/make.bat | 2 +- heartbeat/Dockerfile | 2 +- heartbeat/make.bat | 2 +- journalbeat/Dockerfile | 2 +- libbeat/Dockerfile | 2 +- libbeat/docs/version.asciidoc | 2 +- libbeat/make.bat | 2 +- libbeat/scripts/Makefile | 5 ++--- make.bat | 2 +- metricbeat/Dockerfile | 2 +- metricbeat/make.bat | 2 +- metricbeat/module/http/_meta/Dockerfile | 2 +- metricbeat/scripts/mage/docs_collector.go | 3 --- packetbeat/Dockerfile | 2 +- packetbeat/make.bat | 2 +- winlogbeat/make.bat | 2 +- x-pack/filebeat/make.bat | 2 +- x-pack/functionbeat/Dockerfile | 2 +- x-pack/libbeat/Dockerfile | 2 +- x-pack/winlogbeat/make.bat | 2 +- 37 files changed, 43 insertions(+), 108 deletions(-) diff --git a/.ci/scripts/install-tools.bat b/.ci/scripts/install-tools.bat index 54bcaf5e8a4..1a9cb35d97b 100644 --- a/.ci/scripts/install-tools.bat +++ b/.ci/scripts/install-tools.bat @@ -14,7 +14,7 @@ IF ERRORLEVEL 1 ( FOR /f "tokens=*" %%i IN ('"gvm.exe" use %GO_VERSION% --format=batch') DO %%i go env -go install -mod=vendor github.com/magefile/mage +go install github.com/magefile/mage mage -version where mage diff --git a/.go-version b/.go-version index f3352b3fef9..4ea8ad87e6e 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.13.10 +1.14.3 diff --git a/Jenkinsfile b/Jenkinsfile index 3fa86b37495..6bafd726834 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1286,7 +1286,7 @@ def getVendorPatterns(beatName){ "PATH=${env.WORKSPACE}/bin:${goRoot}/bin:${env.PATH}", ]) { output = sh(label: 'Get vendor dependency patterns', returnStdout: true, script: """ - go list -mod=vendor -f '{{ .ImportPath }}{{ "\\n" }}{{ join .Deps "\\n" }}' ./${beatName}\ + go list -f '{{ .ImportPath }}{{ "\\n" }}{{ join .Deps "\\n" }}' ./${beatName}\ |awk '{print \$1"/.*"}'\ |sed -e "s#github.com/elastic/beats/v7/##g" """) diff --git a/auditbeat/Dockerfile b/auditbeat/Dockerfile index 8b09c46a2ab..4c0bed982e0 100644 --- a/auditbeat/Dockerfile +++ b/auditbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.13.10 +FROM golang:1.14.3 RUN \ apt-get update \ diff --git a/auditbeat/make.bat b/auditbeat/make.bat index 61c1fe7a1e6..65bc11f563e 100644 --- a/auditbeat/make.bat +++ b/auditbeat/make.bat @@ -6,6 +6,6 @@ REM REM After running this once you may invoke mage.exe directly. WHERE mage -IF %ERRORLEVEL% NEQ 0 go install -mod=vendor github.com/magefile/mage +IF %ERRORLEVEL% NEQ 0 go install github.com/magefile/mage mage %* diff --git a/dev-tools/mage/build.go b/dev-tools/mage/build.go index d6ac3eb631f..2efe61502ae 100644 --- a/dev-tools/mage/build.go +++ b/dev-tools/mage/build.go @@ -118,16 +118,6 @@ func Build(params BuildArgs) error { } env["CGO_ENABLED"] = cgoEnabled - if UseVendor { - var goFlags string - goFlags, ok := env["GOFLAGS"] - if !ok { - env["GOFLAGS"] = "-mod=vendor" - } else { - env["GOFLAGS"] = strings.Join([]string{goFlags, "-mod=vendor"}, " ") - } - } - // Spec args := []string{ "build", diff --git a/dev-tools/mage/common.go b/dev-tools/mage/common.go index 91d291f5387..97c53ea6121 100644 --- a/dev-tools/mage/common.go +++ b/dev-tools/mage/common.go @@ -806,14 +806,9 @@ func ParseVersion(version string) (major, minor, patch int, err error) { return } -// listModuleDir calls gotool.ListModuleVendorDir or -// gotool.ListModuleCacheDir, depending on the value of -// UseVendor. +// listModuleDir calls gotool.ListModuleVendorDir. func listModuleDir(modpath string) (string, error) { - if UseVendor { - return gotool.ListModuleVendorDir(modpath) - } - return gotool.ListModuleCacheDir(modpath) + return gotool.ListModuleVendorDir(modpath) } // ListMatchingEnvVars returns all of the environment variables names that begin diff --git a/dev-tools/mage/crossbuild.go b/dev-tools/mage/crossbuild.go index d80276a7974..5362426aba2 100644 --- a/dev-tools/mage/crossbuild.go +++ b/dev-tools/mage/crossbuild.go @@ -255,9 +255,6 @@ func (b GolangCrossBuilder) Build() error { if versionQualified { args = append(args, "--env", "VERSION_QUALIFIER="+versionQualifier) } - if UseVendor { - args = append(args, "--env", "GOFLAGS=-mod=vendor") - } if CrossBuildMountModcache { // Mount $GOPATH/pkg/mod into the container, read-only. hostDir := filepath.Join(build.Default.GOPATH, "pkg", "mod") diff --git a/dev-tools/mage/dashboard.go b/dev-tools/mage/dashboard.go index 562a3bf8f79..764a9e28695 100644 --- a/dev-tools/mage/dashboard.go +++ b/dev-tools/mage/dashboard.go @@ -44,7 +44,7 @@ func ExportDashboard() error { return err } - dashboardCmd := sh.RunCmd("go", "run", "-mod", "vendor", filepath.Join(beatsDir, "dev-tools/cmd/dashboards/export_dashboards.go")) + dashboardCmd := sh.RunCmd("go", "run", filepath.Join(beatsDir, "dev-tools/cmd/dashboards/export_dashboards.go")) // TODO: This is currently hardcoded for KB 7, we need to figure out what we do for KB 8 if applicable file := CWD("module", module, "_meta/kibana/7/dashboard", id+".json") diff --git a/dev-tools/mage/fields.go b/dev-tools/mage/fields.go index cb2b6ef7685..01aad08b691 100644 --- a/dev-tools/mage/fields.go +++ b/dev-tools/mage/fields.go @@ -102,9 +102,6 @@ func generateFieldsYAML(baseDir, output string, moduleDirs ...string) error { } cmd := []string{"run"} - if UseVendor { - cmd = append(cmd, "-mod", "vendor") - } cmd = append(cmd, filepath.Join(beatsDir, globalFieldsCmdPath), "-es_beats_path", beatsDir, @@ -130,18 +127,15 @@ func GenerateFieldsGo(fieldsYML, out string) error { return err } - cmd := []string{"run"} - if UseVendor { - cmd = append(cmd, "-mod", "vendor") - } - cmd = append(cmd, + cmd := []string{ + "run", filepath.Join(beatsDir, assetCmdPath), "-pkg", "include", "-in", fieldsYML, "-out", CreateDir(out), "-license", toLibbeatLicenseName(BeatLicense), BeatName, - ) + } assetCmd := sh.RunCmd("go", cmd...) return assetCmd() @@ -163,9 +157,6 @@ func GenerateModuleFieldsGo(moduleDir string) error { } cmd := []string{"run"} - if UseVendor { - cmd = append(cmd, "-mod", "vendor") - } cmd = append(cmd, filepath.Join(beatsDir, moduleFieldsCmdPath), "-beat", BeatName, @@ -194,16 +185,13 @@ func GenerateIncludeListGo(options IncludeListOptions) error { return err } - cmd := []string{"run"} - if UseVendor { - cmd = append(cmd, "-mod", "vendor") - } - cmd = append(cmd, + cmd := []string{ + "run", filepath.Join(beatsDir, moduleIncludeListCmdPath), "-license", toLibbeatLicenseName(BeatLicense), "-out", options.Outfile, "-buildTags", options.BuildTags, "-pkg", options.Pkg, - ) + } includeListCmd := sh.RunCmd("go", cmd...) diff --git a/dev-tools/mage/fmt.go b/dev-tools/mage/fmt.go index 02a8001895e..ed034e3fc9a 100644 --- a/dev-tools/mage/fmt.go +++ b/dev-tools/mage/fmt.go @@ -66,19 +66,10 @@ func GoImports() error { } fmt.Println(">> fmt - goimports: Formatting Go code") - if UseVendor { - if err := gotool.Install( - gotool.Install.Vendored(), - gotool.Install.Package(filepath.Join(GoImportsImportPath)), - ); err != nil { - return err - } - } else { - if err := gotool.Get( - gotool.Get.Package(filepath.Join(GoImportsImportPath)), - ); err != nil { - return err - } + if err := gotool.Install( + gotool.Install.Package(filepath.Join(GoImportsImportPath)), + ); err != nil { + return err } args := append( diff --git a/dev-tools/mage/install.go b/dev-tools/mage/install.go index 67483d23bb9..e36896017de 100644 --- a/dev-tools/mage/install.go +++ b/dev-tools/mage/install.go @@ -26,21 +26,7 @@ var ( GoLicenserImportPath = "github.com/elastic/go-licenser" ) -// InstallVendored uses go get to install a command from its vendored source -func InstallVendored(importPath string) error { - install := gotool.Install - return install( - install.Vendored(), - install.Package(importPath), - ) -} - // InstallGoLicenser target installs go-licenser func InstallGoLicenser() error { - if UseVendor { - return InstallVendored(GoLicenserImportPath) - } - return gotool.Get( - gotool.Get.Package(GoLicenserImportPath), - ) + return gotool.Install(gotool.Install.Package(GoLicenserImportPath)) } diff --git a/dev-tools/mage/integtest.go b/dev-tools/mage/integtest.go index 064dc7d8102..e932a55c45d 100644 --- a/dev-tools/mage/integtest.go +++ b/dev-tools/mage/integtest.go @@ -245,9 +245,6 @@ func initRunner(tester IntegrationTester, dir string, passInEnv map[string]strin if mg.Verbose() { env["MAGEFILE_VERBOSE"] = "1" } - if UseVendor { - env["GOFLAGS"] = "-mod=vendor" - } runner := &IntegrationRunner{ steps: runnerSteps, diff --git a/dev-tools/mage/settings.go b/dev-tools/mage/settings.go index 8e6f0b85c17..dfd64e840ea 100644 --- a/dev-tools/mage/settings.go +++ b/dev-tools/mage/settings.go @@ -60,7 +60,6 @@ var ( XPackDir = "../x-pack" RaceDetector = false TestCoverage = false - UseVendor = true // CrossBuildMountModcache, if true, mounts $GOPATH/pkg/mod into // the crossbuild images at /go/pkg/mod, read-only. @@ -110,10 +109,6 @@ func init() { if err != nil { panic(errors.Wrap(err, "failed to parse TEST_COVERAGE env value")) } - UseVendor, err = strconv.ParseBool(EnvOr("USE_VENDOR", "true")) - if err != nil { - panic(errors.Wrap(err, "failed to parse USE_VENDOR env value")) - } Snapshot, err = strconv.ParseBool(EnvOr("SNAPSHOT", "false")) if err != nil { diff --git a/dev-tools/make/mage-install.mk b/dev-tools/make/mage-install.mk index 8966ed6f474..d64048d7f0e 100644 --- a/dev-tools/make/mage-install.mk +++ b/dev-tools/make/mage-install.mk @@ -7,7 +7,7 @@ export MAGE_IMPORT_PATH mage: ifndef MAGE_PRESENT @echo Installing mage $(MAGE_VERSION) from vendor dir. - @go install -mod=vendor -ldflags="-X $(MAGE_IMPORT_PATH)/mage.gitTag=$(MAGE_VERSION)" ${MAGE_IMPORT_PATH}/... + @go install -ldflags="-X $(MAGE_IMPORT_PATH)/mage.gitTag=$(MAGE_VERSION)" ${MAGE_IMPORT_PATH}/... @-mage -clean endif @true diff --git a/dev-tools/packaging/packages.yml b/dev-tools/packaging/packages.yml index 283273178bc..10f54bcc9d4 100644 --- a/dev-tools/packaging/packages.yml +++ b/dev-tools/packaging/packages.yml @@ -66,8 +66,8 @@ shared: - &macos_agent_pkg_spec <<: *common extra_vars: - # OS X 10.11 Mountain Lion is the oldest supported by Go 1.13. - # https://golang.org/doc/go1.13#ports + # OS X 10.11 El Capitan is the oldest supported by Go 1.14. + # https://golang.org/doc/go1.14#ports min_supported_osx_version: 10.11 identifier: 'co.{{.BeatVendor | tolower}}.beats.{{.BeatName}}' install_path: /Library/Application Support diff --git a/filebeat/Dockerfile b/filebeat/Dockerfile index b6ad8cd5d00..cfe4de1b5c9 100644 --- a/filebeat/Dockerfile +++ b/filebeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.13.10 +FROM golang:1.14.3 RUN \ apt-get update \ diff --git a/filebeat/make.bat b/filebeat/make.bat index 61c1fe7a1e6..65bc11f563e 100644 --- a/filebeat/make.bat +++ b/filebeat/make.bat @@ -6,6 +6,6 @@ REM REM After running this once you may invoke mage.exe directly. WHERE mage -IF %ERRORLEVEL% NEQ 0 go install -mod=vendor github.com/magefile/mage +IF %ERRORLEVEL% NEQ 0 go install github.com/magefile/mage mage %* diff --git a/heartbeat/Dockerfile b/heartbeat/Dockerfile index 5a176a5f36c..0d8a4c29d43 100644 --- a/heartbeat/Dockerfile +++ b/heartbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.13.10 +FROM golang:1.14.3 RUN \ apt-get update \ diff --git a/heartbeat/make.bat b/heartbeat/make.bat index 61c1fe7a1e6..65bc11f563e 100644 --- a/heartbeat/make.bat +++ b/heartbeat/make.bat @@ -6,6 +6,6 @@ REM REM After running this once you may invoke mage.exe directly. WHERE mage -IF %ERRORLEVEL% NEQ 0 go install -mod=vendor github.com/magefile/mage +IF %ERRORLEVEL% NEQ 0 go install github.com/magefile/mage mage %* diff --git a/journalbeat/Dockerfile b/journalbeat/Dockerfile index bd5c9b63592..d67159f861f 100644 --- a/journalbeat/Dockerfile +++ b/journalbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.13.10 +FROM golang:1.14.3 RUN \ apt-get update \ diff --git a/libbeat/Dockerfile b/libbeat/Dockerfile index f70c239e6ae..5dfb06837a5 100644 --- a/libbeat/Dockerfile +++ b/libbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.13.10 +FROM golang:1.14.3 RUN \ apt-get update \ diff --git a/libbeat/docs/version.asciidoc b/libbeat/docs/version.asciidoc index b13ca0b7d52..3241e54271e 100644 --- a/libbeat/docs/version.asciidoc +++ b/libbeat/docs/version.asciidoc @@ -1,6 +1,6 @@ :stack-version: 8.0.0 :doc-branch: master -:go-version: 1.13.10 +:go-version: 1.14.3 :release-state: unreleased :python: 3.7 :docker: 1.12 diff --git a/libbeat/make.bat b/libbeat/make.bat index 61c1fe7a1e6..65bc11f563e 100644 --- a/libbeat/make.bat +++ b/libbeat/make.bat @@ -6,6 +6,6 @@ REM REM After running this once you may invoke mage.exe directly. WHERE mage -IF %ERRORLEVEL% NEQ 0 go install -mod=vendor github.com/magefile/mage +IF %ERRORLEVEL% NEQ 0 go install github.com/magefile/mage mage %* diff --git a/libbeat/scripts/Makefile b/libbeat/scripts/Makefile index f634e9fd40f..36030243177 100755 --- a/libbeat/scripts/Makefile +++ b/libbeat/scripts/Makefile @@ -25,7 +25,6 @@ ELASTIC_LICENSE_FILE?=../licenses/ELASTIC-LICENSE.txt SECCOMP_BINARY?=${BEAT_NAME} SECCOMP_BLACKLIST?=${ES_BEATS}/libbeat/common/seccomp/seccomp-profiler-blacklist.txt SECCOMP_ALLOWLIST?=${ES_BEATS}/libbeat/common/seccomp/seccomp-profiler-allow.txt -INSTALL_FLAG?=-mod=vendor INSTALL_CMD?=install ${INSTALL_FLAG} export INSTALL_FLAG export INSTALL_CMD @@ -146,7 +145,7 @@ ${BEAT_NAME}.test: $(GOFILES_ALL) crosscompile: ## @build Cross-compile beat for the OS'es specified in GOX_OS variable. The binaries are placed in the build/bin directory. crosscompile: $(GOFILES) ifneq ($(shell [[ $(BEAT_NAME) == journalbeat ]] && echo true ),true) - go install -mod=vendor github.com/mitchellh/gox + go install github.com/mitchellh/gox mkdir -p ${BUILD_DIR}/bin gox -output="${BUILD_DIR}/bin/{{.Dir}}-{{.OS}}-{{.Arch}}" -os="$(strip $(GOX_OS))" -osarch="$(strip $(GOX_OSARCH))" ${GOX_FLAGS} endif @@ -175,7 +174,7 @@ fmt: add-headers python-env ## @build Runs `goimports -l -w` and `autopep8`on th .PHONY: lint lint: - @go install -mod=vendor $(GOLINT_REPO) $(REVIEWDOG_REPO) + @go install $(GOLINT_REPO) $(REVIEWDOG_REPO) $(REVIEWDOG) $(REVIEWDOG_OPTIONS) .PHONY: clean diff --git a/make.bat b/make.bat index 61c1fe7a1e6..65bc11f563e 100644 --- a/make.bat +++ b/make.bat @@ -6,6 +6,6 @@ REM REM After running this once you may invoke mage.exe directly. WHERE mage -IF %ERRORLEVEL% NEQ 0 go install -mod=vendor github.com/magefile/mage +IF %ERRORLEVEL% NEQ 0 go install github.com/magefile/mage mage %* diff --git a/metricbeat/Dockerfile b/metricbeat/Dockerfile index 8272144a988..c941fa4e383 100644 --- a/metricbeat/Dockerfile +++ b/metricbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.13.10 +FROM golang:1.14.3 RUN \ apt update \ diff --git a/metricbeat/make.bat b/metricbeat/make.bat index 61c1fe7a1e6..65bc11f563e 100644 --- a/metricbeat/make.bat +++ b/metricbeat/make.bat @@ -6,6 +6,6 @@ REM REM After running this once you may invoke mage.exe directly. WHERE mage -IF %ERRORLEVEL% NEQ 0 go install -mod=vendor github.com/magefile/mage +IF %ERRORLEVEL% NEQ 0 go install github.com/magefile/mage mage %* diff --git a/metricbeat/module/http/_meta/Dockerfile b/metricbeat/module/http/_meta/Dockerfile index 973035bd8ef..1778fc23f70 100644 --- a/metricbeat/module/http/_meta/Dockerfile +++ b/metricbeat/module/http/_meta/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.13.10 +FROM golang:1.14.3 COPY test/main.go main.go diff --git a/metricbeat/scripts/mage/docs_collector.go b/metricbeat/scripts/mage/docs_collector.go index 427975a7cf1..b58bad3edae 100644 --- a/metricbeat/scripts/mage/docs_collector.go +++ b/metricbeat/scripts/mage/docs_collector.go @@ -147,9 +147,6 @@ func getDefaultMetricsets() (map[string][]string, error) { } cmd := []string{"run"} - if mage.UseVendor { - cmd = append(cmd, "-mod", "vendor") - } for _, dir := range runpaths { rawMap, err := sh.OutCmd("go", append(cmd, dir)...)() if err != nil { diff --git a/packetbeat/Dockerfile b/packetbeat/Dockerfile index c0abe357b8e..e1ca656db19 100644 --- a/packetbeat/Dockerfile +++ b/packetbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.13.10 +FROM golang:1.14.3 RUN \ apt-get update \ diff --git a/packetbeat/make.bat b/packetbeat/make.bat index 61c1fe7a1e6..65bc11f563e 100644 --- a/packetbeat/make.bat +++ b/packetbeat/make.bat @@ -6,6 +6,6 @@ REM REM After running this once you may invoke mage.exe directly. WHERE mage -IF %ERRORLEVEL% NEQ 0 go install -mod=vendor github.com/magefile/mage +IF %ERRORLEVEL% NEQ 0 go install github.com/magefile/mage mage %* diff --git a/winlogbeat/make.bat b/winlogbeat/make.bat index 61c1fe7a1e6..65bc11f563e 100644 --- a/winlogbeat/make.bat +++ b/winlogbeat/make.bat @@ -6,6 +6,6 @@ REM REM After running this once you may invoke mage.exe directly. WHERE mage -IF %ERRORLEVEL% NEQ 0 go install -mod=vendor github.com/magefile/mage +IF %ERRORLEVEL% NEQ 0 go install github.com/magefile/mage mage %* diff --git a/x-pack/filebeat/make.bat b/x-pack/filebeat/make.bat index 61c1fe7a1e6..65bc11f563e 100644 --- a/x-pack/filebeat/make.bat +++ b/x-pack/filebeat/make.bat @@ -6,6 +6,6 @@ REM REM After running this once you may invoke mage.exe directly. WHERE mage -IF %ERRORLEVEL% NEQ 0 go install -mod=vendor github.com/magefile/mage +IF %ERRORLEVEL% NEQ 0 go install github.com/magefile/mage mage %* diff --git a/x-pack/functionbeat/Dockerfile b/x-pack/functionbeat/Dockerfile index fec079abbba..9bbb53b67a5 100644 --- a/x-pack/functionbeat/Dockerfile +++ b/x-pack/functionbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.13.10 +FROM golang:1.14.3 RUN \ apt-get update \ diff --git a/x-pack/libbeat/Dockerfile b/x-pack/libbeat/Dockerfile index 9da973a304e..a0255557519 100644 --- a/x-pack/libbeat/Dockerfile +++ b/x-pack/libbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.13.10 +FROM golang:1.14.3 RUN \ apt-get update \ diff --git a/x-pack/winlogbeat/make.bat b/x-pack/winlogbeat/make.bat index 61c1fe7a1e6..65bc11f563e 100644 --- a/x-pack/winlogbeat/make.bat +++ b/x-pack/winlogbeat/make.bat @@ -6,6 +6,6 @@ REM REM After running this once you may invoke mage.exe directly. WHERE mage -IF %ERRORLEVEL% NEQ 0 go install -mod=vendor github.com/magefile/mage +IF %ERRORLEVEL% NEQ 0 go install github.com/magefile/mage mage %* From face253ebbb416b57b8d4d2f3e07479af183d788 Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Thu, 28 May 2020 16:14:10 -0400 Subject: [PATCH 2/8] Update changelog. --- CHANGELOG.next.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index fda61aacbbe..f82ae7e75ed 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -18,6 +18,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Remove the non-ECS `agent.hostname` field. Use the `agent.name` or `agent.id` fields for an identifier. {issue}16377[16377] {pull}18328[18328] - Make error message about locked data path actionable. {pull}18667[18667] - Ensure dynamic template names are unique for the same field. {pull}18849[18849] +- Update to Golang 1.14.3 and remove usage of -mod=vendor. {pull}18829[18829] *Auditbeat* From e08f358e303bc8e7078f49b4429e73b8f8c9257d Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Fri, 29 May 2020 09:34:26 -0400 Subject: [PATCH 3/8] Fix metricbeat tests. --- metricbeat/module/apache/status/status_test.go | 4 ++-- metricbeat/module/envoyproxy/server/server_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/metricbeat/module/apache/status/status_test.go b/metricbeat/module/apache/status/status_test.go index 182b41e1af3..c7346278c9e 100644 --- a/metricbeat/module/apache/status/status_test.go +++ b/metricbeat/module/apache/status/status_test.go @@ -178,12 +178,12 @@ func TestFetchTimeout(t *testing.T) { elapsed := time.Since(start) var found bool for _, err := range errs { - if strings.Contains(err.Error(), "request canceled (Client.Timeout exceeded") { + if strings.Contains(err.Error(), "context deadline exceeded (Client.Timeout exceeded") { found = true } } if !found { - assert.Failf(t, "", "expected an error containing 'request canceled (Client.Timeout exceeded'. Got %v", errs) + assert.Failf(t, "", "expected an error containing 'context deadline exceeded (Client.Timeout exceeded'. Got %v", errs) } // Elapsed should be ~50ms, sometimes it can be up to 1s diff --git a/metricbeat/module/envoyproxy/server/server_test.go b/metricbeat/module/envoyproxy/server/server_test.go index c4f8eb77594..df3b00886c9 100644 --- a/metricbeat/module/envoyproxy/server/server_test.go +++ b/metricbeat/module/envoyproxy/server/server_test.go @@ -184,12 +184,12 @@ func TestFetchTimeout(t *testing.T) { elapsed := time.Since(start) var found bool for _, err := range errs { - if strings.Contains(err.Error(), "request canceled (Client.Timeout exceeded") { + if strings.Contains(err.Error(), "context deadline exceeded (Client.Timeout exceeded") { found = true } } if !found { - assert.Failf(t, "", "expected an error containing 'request canceled (Client.Timeout exceeded'. Got %v", errs) + assert.Failf(t, "", "expected an error containing 'context deadline exceeded (Client.Timeout exceeded'. Got %v", errs) } assert.True(t, elapsed < 5*time.Second, "elapsed time: %s", elapsed.String()) From 01d774eafb65fbddad408e322d12a803ea2889e0 Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Tue, 2 Jun 2020 09:18:59 -0400 Subject: [PATCH 4/8] Update to go 1.14.4 --- .go-version | 2 +- CHANGELOG.next.asciidoc | 1 + auditbeat/Dockerfile | 2 +- filebeat/Dockerfile | 2 +- heartbeat/Dockerfile | 2 +- journalbeat/Dockerfile | 2 +- libbeat/Dockerfile | 2 +- libbeat/docs/version.asciidoc | 2 +- metricbeat/Dockerfile | 2 +- metricbeat/module/http/_meta/Dockerfile | 2 +- packetbeat/Dockerfile | 2 +- x-pack/functionbeat/Dockerfile | 2 +- x-pack/libbeat/Dockerfile | 2 +- 13 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.go-version b/.go-version index 4ea8ad87e6e..4e00d0ac079 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.14.3 +1.14.4 diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index f82ae7e75ed..d5c16cd90dd 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -19,6 +19,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Make error message about locked data path actionable. {pull}18667[18667] - Ensure dynamic template names are unique for the same field. {pull}18849[18849] - Update to Golang 1.14.3 and remove usage of -mod=vendor. {pull}18829[18829] +- Update to Golang 1.14.4 and remove usage of -mod=vendor. {pull}18829[18829] *Auditbeat* diff --git a/auditbeat/Dockerfile b/auditbeat/Dockerfile index 4c0bed982e0..d6eccf387e5 100644 --- a/auditbeat/Dockerfile +++ b/auditbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.14.3 +FROM golang:1.14.4 RUN \ apt-get update \ diff --git a/filebeat/Dockerfile b/filebeat/Dockerfile index cfe4de1b5c9..852903e082d 100644 --- a/filebeat/Dockerfile +++ b/filebeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.14.3 +FROM golang:1.14.4 RUN \ apt-get update \ diff --git a/heartbeat/Dockerfile b/heartbeat/Dockerfile index 0d8a4c29d43..1cd6adba6f7 100644 --- a/heartbeat/Dockerfile +++ b/heartbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.14.3 +FROM golang:1.14.4 RUN \ apt-get update \ diff --git a/journalbeat/Dockerfile b/journalbeat/Dockerfile index d67159f861f..3db53ea8325 100644 --- a/journalbeat/Dockerfile +++ b/journalbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.14.3 +FROM golang:1.14.4 RUN \ apt-get update \ diff --git a/libbeat/Dockerfile b/libbeat/Dockerfile index 5dfb06837a5..bce6113fbe2 100644 --- a/libbeat/Dockerfile +++ b/libbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.14.3 +FROM golang:1.14.4 RUN \ apt-get update \ diff --git a/libbeat/docs/version.asciidoc b/libbeat/docs/version.asciidoc index 3241e54271e..780a8c3d932 100644 --- a/libbeat/docs/version.asciidoc +++ b/libbeat/docs/version.asciidoc @@ -1,6 +1,6 @@ :stack-version: 8.0.0 :doc-branch: master -:go-version: 1.14.3 +:go-version: 1.14.4 :release-state: unreleased :python: 3.7 :docker: 1.12 diff --git a/metricbeat/Dockerfile b/metricbeat/Dockerfile index c941fa4e383..4f4ba302031 100644 --- a/metricbeat/Dockerfile +++ b/metricbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.14.3 +FROM golang:1.14.4 RUN \ apt update \ diff --git a/metricbeat/module/http/_meta/Dockerfile b/metricbeat/module/http/_meta/Dockerfile index 1778fc23f70..5d36c7f7b19 100644 --- a/metricbeat/module/http/_meta/Dockerfile +++ b/metricbeat/module/http/_meta/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.14.3 +FROM golang:1.14.4 COPY test/main.go main.go diff --git a/packetbeat/Dockerfile b/packetbeat/Dockerfile index e1ca656db19..40d389f6cf6 100644 --- a/packetbeat/Dockerfile +++ b/packetbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.14.3 +FROM golang:1.14.4 RUN \ apt-get update \ diff --git a/x-pack/functionbeat/Dockerfile b/x-pack/functionbeat/Dockerfile index 9bbb53b67a5..3a5c3e8e8dd 100644 --- a/x-pack/functionbeat/Dockerfile +++ b/x-pack/functionbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.14.3 +FROM golang:1.14.4 RUN \ apt-get update \ diff --git a/x-pack/libbeat/Dockerfile b/x-pack/libbeat/Dockerfile index a0255557519..e22ae8654d5 100644 --- a/x-pack/libbeat/Dockerfile +++ b/x-pack/libbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.14.3 +FROM golang:1.14.4 RUN \ apt-get update \ From cc7555dd3344d897370e2f1f0cd006b30be8eab3 Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Tue, 2 Jun 2020 09:21:51 -0400 Subject: [PATCH 5/8] Fix changelog. --- CHANGELOG.next.asciidoc | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index d5c16cd90dd..f3a6d928eee 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -18,7 +18,6 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Remove the non-ECS `agent.hostname` field. Use the `agent.name` or `agent.id` fields for an identifier. {issue}16377[16377] {pull}18328[18328] - Make error message about locked data path actionable. {pull}18667[18667] - Ensure dynamic template names are unique for the same field. {pull}18849[18849] -- Update to Golang 1.14.3 and remove usage of -mod=vendor. {pull}18829[18829] - Update to Golang 1.14.4 and remove usage of -mod=vendor. {pull}18829[18829] *Auditbeat* From 89abd75f8b272142ec831f5018fcff3faf2a921e Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Tue, 2 Jun 2020 09:23:15 -0400 Subject: [PATCH 6/8] Update go.mod to go 1.14. --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index e28fba6e3b1..265752c0013 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/elastic/beats/v7 -go 1.13 +go 1.14 require ( 4d63.com/tz v1.1.1-0.20191124060701-6d37baae851b From 8d98dd2cf84a3faf1c84359df06947b45431baa4 Mon Sep 17 00:00:00 2001 From: sayden Date: Mon, 6 Jul 2020 16:06:46 +0200 Subject: [PATCH 7/8] Revert changes of UseVendor --- dev-tools/mage/build.go | 10 ++++++++++ dev-tools/mage/common.go | 9 +++++++-- dev-tools/mage/crossbuild.go | 3 +++ dev-tools/mage/fields.go | 24 +++++++++++++++++------ dev-tools/mage/install.go | 16 ++++++++++++++- dev-tools/mage/integtest.go | 3 +++ metricbeat/scripts/mage/docs_collector.go | 3 +++ 7 files changed, 59 insertions(+), 9 deletions(-) diff --git a/dev-tools/mage/build.go b/dev-tools/mage/build.go index 2efe61502ae..d6ac3eb631f 100644 --- a/dev-tools/mage/build.go +++ b/dev-tools/mage/build.go @@ -118,6 +118,16 @@ func Build(params BuildArgs) error { } env["CGO_ENABLED"] = cgoEnabled + if UseVendor { + var goFlags string + goFlags, ok := env["GOFLAGS"] + if !ok { + env["GOFLAGS"] = "-mod=vendor" + } else { + env["GOFLAGS"] = strings.Join([]string{goFlags, "-mod=vendor"}, " ") + } + } + // Spec args := []string{ "build", diff --git a/dev-tools/mage/common.go b/dev-tools/mage/common.go index 97c53ea6121..91d291f5387 100644 --- a/dev-tools/mage/common.go +++ b/dev-tools/mage/common.go @@ -806,9 +806,14 @@ func ParseVersion(version string) (major, minor, patch int, err error) { return } -// listModuleDir calls gotool.ListModuleVendorDir. +// listModuleDir calls gotool.ListModuleVendorDir or +// gotool.ListModuleCacheDir, depending on the value of +// UseVendor. func listModuleDir(modpath string) (string, error) { - return gotool.ListModuleVendorDir(modpath) + if UseVendor { + return gotool.ListModuleVendorDir(modpath) + } + return gotool.ListModuleCacheDir(modpath) } // ListMatchingEnvVars returns all of the environment variables names that begin diff --git a/dev-tools/mage/crossbuild.go b/dev-tools/mage/crossbuild.go index 5362426aba2..d80276a7974 100644 --- a/dev-tools/mage/crossbuild.go +++ b/dev-tools/mage/crossbuild.go @@ -255,6 +255,9 @@ func (b GolangCrossBuilder) Build() error { if versionQualified { args = append(args, "--env", "VERSION_QUALIFIER="+versionQualifier) } + if UseVendor { + args = append(args, "--env", "GOFLAGS=-mod=vendor") + } if CrossBuildMountModcache { // Mount $GOPATH/pkg/mod into the container, read-only. hostDir := filepath.Join(build.Default.GOPATH, "pkg", "mod") diff --git a/dev-tools/mage/fields.go b/dev-tools/mage/fields.go index 01aad08b691..cb2b6ef7685 100644 --- a/dev-tools/mage/fields.go +++ b/dev-tools/mage/fields.go @@ -102,6 +102,9 @@ func generateFieldsYAML(baseDir, output string, moduleDirs ...string) error { } cmd := []string{"run"} + if UseVendor { + cmd = append(cmd, "-mod", "vendor") + } cmd = append(cmd, filepath.Join(beatsDir, globalFieldsCmdPath), "-es_beats_path", beatsDir, @@ -127,15 +130,18 @@ func GenerateFieldsGo(fieldsYML, out string) error { return err } - cmd := []string{ - "run", + cmd := []string{"run"} + if UseVendor { + cmd = append(cmd, "-mod", "vendor") + } + cmd = append(cmd, filepath.Join(beatsDir, assetCmdPath), "-pkg", "include", "-in", fieldsYML, "-out", CreateDir(out), "-license", toLibbeatLicenseName(BeatLicense), BeatName, - } + ) assetCmd := sh.RunCmd("go", cmd...) return assetCmd() @@ -157,6 +163,9 @@ func GenerateModuleFieldsGo(moduleDir string) error { } cmd := []string{"run"} + if UseVendor { + cmd = append(cmd, "-mod", "vendor") + } cmd = append(cmd, filepath.Join(beatsDir, moduleFieldsCmdPath), "-beat", BeatName, @@ -185,13 +194,16 @@ func GenerateIncludeListGo(options IncludeListOptions) error { return err } - cmd := []string{ - "run", + cmd := []string{"run"} + if UseVendor { + cmd = append(cmd, "-mod", "vendor") + } + cmd = append(cmd, filepath.Join(beatsDir, moduleIncludeListCmdPath), "-license", toLibbeatLicenseName(BeatLicense), "-out", options.Outfile, "-buildTags", options.BuildTags, "-pkg", options.Pkg, - } + ) includeListCmd := sh.RunCmd("go", cmd...) diff --git a/dev-tools/mage/install.go b/dev-tools/mage/install.go index e36896017de..67483d23bb9 100644 --- a/dev-tools/mage/install.go +++ b/dev-tools/mage/install.go @@ -26,7 +26,21 @@ var ( GoLicenserImportPath = "github.com/elastic/go-licenser" ) +// InstallVendored uses go get to install a command from its vendored source +func InstallVendored(importPath string) error { + install := gotool.Install + return install( + install.Vendored(), + install.Package(importPath), + ) +} + // InstallGoLicenser target installs go-licenser func InstallGoLicenser() error { - return gotool.Install(gotool.Install.Package(GoLicenserImportPath)) + if UseVendor { + return InstallVendored(GoLicenserImportPath) + } + return gotool.Get( + gotool.Get.Package(GoLicenserImportPath), + ) } diff --git a/dev-tools/mage/integtest.go b/dev-tools/mage/integtest.go index e932a55c45d..064dc7d8102 100644 --- a/dev-tools/mage/integtest.go +++ b/dev-tools/mage/integtest.go @@ -245,6 +245,9 @@ func initRunner(tester IntegrationTester, dir string, passInEnv map[string]strin if mg.Verbose() { env["MAGEFILE_VERBOSE"] = "1" } + if UseVendor { + env["GOFLAGS"] = "-mod=vendor" + } runner := &IntegrationRunner{ steps: runnerSteps, diff --git a/metricbeat/scripts/mage/docs_collector.go b/metricbeat/scripts/mage/docs_collector.go index b58bad3edae..427975a7cf1 100644 --- a/metricbeat/scripts/mage/docs_collector.go +++ b/metricbeat/scripts/mage/docs_collector.go @@ -147,6 +147,9 @@ func getDefaultMetricsets() (map[string][]string, error) { } cmd := []string{"run"} + if mage.UseVendor { + cmd = append(cmd, "-mod", "vendor") + } for _, dir := range runpaths { rawMap, err := sh.OutCmd("go", append(cmd, dir)...)() if err != nil { From b636301f50a8d0cdd021db5f0c24de1bc2212bac Mon Sep 17 00:00:00 2001 From: sayden Date: Tue, 7 Jul 2020 09:56:48 +0200 Subject: [PATCH 8/8] Modify changelog --- CHANGELOG.next.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 1af62cc2a32..b49809bc613 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -18,7 +18,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Remove the non-ECS `agent.hostname` field. Use the `agent.name` or `agent.id` fields for an identifier. {issue}16377[16377] {pull}18328[18328] - Make error message about locked data path actionable. {pull}18667[18667] - Ensure dynamic template names are unique for the same field. {pull}18849[18849] -- Update to Golang 1.14.4 and remove usage of -mod=vendor. {pull}18829[18829] +- Update to Golang 1.14.4 {pull}18829[18829] *Auditbeat*