Skip to content

Commit 7580c72

Browse files
authored
Update go version to 1.14.4 (elastic#19753)
## What does this PR do? This PR adds support for Golang 1.14.4 in Beats. The dependency `golang.org/x/tools` is pinned to `release-branch.go1.14`. The generated Beats no longer contain a vendor folder. ## Why is it important? Go 1.14 has been out for quite some time. It is high time we update. ## Related issues Closes elastic#18829 Closes elastic#16566
1 parent 4f97c13 commit 7580c72

37 files changed

Lines changed: 48 additions & 1582 deletions

File tree

.go-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.13.10
1+
1.14.4

CHANGELOG-developer.next.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,4 @@ The list below covers the major changes between 7.0.0-rc2 and master only.
9595
- Add IP* fields to `fields.yml` generator script in Filebeat. {issue}17998[17998] {pull}18256[18256]
9696
- Events intended for the Elasticsearch output can now take an `op_type` metadata field of type events.OpType or string to indicate the `op_type` to use for bulk indexing. {pull}12606[12606]
9797
- Remove vendor folder from repository. {pull}18655[18655]
98+
- Update Go version to 1.14.4. {pull}19753[19753]

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ check: python-env
9898
@$(foreach var,$(PROJECTS) dev-tools $(PROJECTS_XPACK_MAGE),$(MAKE) -C $(var) check || exit 1;)
9999
@$(FIND) -name *.py -name *.py -not -path "*/build/*" -exec $(PYTHON_ENV)/bin/autopep8 -d --max-line-length 120 {} \; | (! grep . -q) || (echo "Code differs from autopep8's style" && false)
100100
@$(FIND) -name *.py -not -path "*/build/*" | xargs $(PYTHON_ENV)/bin/pylint --py3k -E || (echo "Code is not compatible with Python 3" && false)
101+
# check if vendor folder does not exists
102+
[ ! -d vendor ]
101103
@# Validate that all updates were committed
102104
@$(MAKE) update
103105
@$(MAKE) check-headers

NOTICE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15626,11 +15626,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1562615626

1562715627
--------------------------------------------------------------------------------
1562815628
Dependency : golang.org/x/tools
15629-
Version: v0.0.0-20200615191743-991d59a616de
15629+
Version: v0.0.0-20200602230032-c00d67ef29d0
1563015630
Licence type (autodetected): BSD-3-Clause
1563115631
--------------------------------------------------------------------------------
1563215632

15633-
Contents of probable licence file $GOMODCACHE/golang.org/x/tools@v0.0.0-20200615191743-991d59a616de/LICENSE:
15633+
Contents of probable licence file $GOMODCACHE/golang.org/x/tools@v0.0.0-20200602230032-c00d67ef29d0/LICENSE:
1563415634

1563515635
Copyright (c) 2009 The Go Authors. All rights reserved.
1563615636

auditbeat/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.13.10
1+
FROM golang:1.14.4
22

33
RUN \
44
apt-get update \

dev-tools/mage/build.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,6 @@ func Build(params BuildArgs) error {
118118
}
119119
env["CGO_ENABLED"] = cgoEnabled
120120

121-
if UseVendor {
122-
var goFlags string
123-
goFlags, ok := env["GOFLAGS"]
124-
if !ok {
125-
env["GOFLAGS"] = "-mod=vendor"
126-
} else {
127-
env["GOFLAGS"] = strings.Join([]string{goFlags, "-mod=vendor"}, " ")
128-
}
129-
}
130-
131121
// Spec
132122
args := []string{
133123
"build",

dev-tools/mage/common.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ import (
4949
"github.com/magefile/mage/sh"
5050
"github.com/magefile/mage/target"
5151
"github.com/pkg/errors"
52-
53-
"github.com/elastic/beats/v7/dev-tools/mage/gotool"
5452
)
5553

5654
// Expand expands the given Go text/template string.
@@ -806,16 +804,6 @@ func ParseVersion(version string) (major, minor, patch int, err error) {
806804
return
807805
}
808806

809-
// listModuleDir calls gotool.ListModuleVendorDir or
810-
// gotool.ListModuleCacheDir, depending on the value of
811-
// UseVendor.
812-
func listModuleDir(modpath string) (string, error) {
813-
if UseVendor {
814-
return gotool.ListModuleVendorDir(modpath)
815-
}
816-
return gotool.ListModuleCacheDir(modpath)
817-
}
818-
819807
// ListMatchingEnvVars returns all of the environment variables names that begin
820808
// with prefix.
821809
func ListMatchingEnvVars(prefixes ...string) []string {

dev-tools/mage/crossbuild.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,6 @@ func (b GolangCrossBuilder) Build() error {
255255
if versionQualified {
256256
args = append(args, "--env", "VERSION_QUALIFIER="+versionQualifier)
257257
}
258-
if UseVendor {
259-
args = append(args, "--env", "GOFLAGS=-mod=vendor")
260-
}
261258
if CrossBuildMountModcache {
262259
// Mount $GOPATH/pkg/mod into the container, read-only.
263260
hostDir := filepath.Join(build.Default.GOPATH, "pkg", "mod")

dev-tools/mage/fields.go

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,12 @@ func generateFieldsYAML(baseDir, output string, moduleDirs ...string) error {
101101
return err
102102
}
103103

104-
cmd := []string{"run"}
105-
if UseVendor {
106-
cmd = append(cmd, "-mod", "vendor")
107-
}
108-
cmd = append(cmd,
104+
cmd := []string{"run",
109105
filepath.Join(beatsDir, globalFieldsCmdPath),
110106
"-es_beats_path", beatsDir,
111107
"-beat_path", baseDir,
112108
"-out", CreateDir(output),
113-
)
109+
}
114110
globalFieldsCmd := sh.RunCmd("go", cmd...)
115111

116112
return globalFieldsCmd(moduleDirs...)
@@ -130,18 +126,14 @@ func GenerateFieldsGo(fieldsYML, out string) error {
130126
return err
131127
}
132128

133-
cmd := []string{"run"}
134-
if UseVendor {
135-
cmd = append(cmd, "-mod", "vendor")
136-
}
137-
cmd = append(cmd,
129+
cmd := []string{"run",
138130
filepath.Join(beatsDir, assetCmdPath),
139131
"-pkg", "include",
140132
"-in", fieldsYML,
141133
"-out", CreateDir(out),
142134
"-license", toLibbeatLicenseName(BeatLicense),
143135
BeatName,
144-
)
136+
}
145137
assetCmd := sh.RunCmd("go", cmd...)
146138

147139
return assetCmd()
@@ -162,16 +154,12 @@ func GenerateModuleFieldsGo(moduleDir string) error {
162154
moduleDir = CWD(moduleDir)
163155
}
164156

165-
cmd := []string{"run"}
166-
if UseVendor {
167-
cmd = append(cmd, "-mod", "vendor")
168-
}
169-
cmd = append(cmd,
157+
cmd := []string{"run",
170158
filepath.Join(beatsDir, moduleFieldsCmdPath),
171159
"-beat", BeatName,
172160
"-license", toLibbeatLicenseName(BeatLicense),
173161
moduleDir,
174-
)
162+
}
175163
moduleFieldsCmd := sh.RunCmd("go", cmd...)
176164

177165
return moduleFieldsCmd()
@@ -194,16 +182,12 @@ func GenerateIncludeListGo(options IncludeListOptions) error {
194182
return err
195183
}
196184

197-
cmd := []string{"run"}
198-
if UseVendor {
199-
cmd = append(cmd, "-mod", "vendor")
200-
}
201-
cmd = append(cmd,
185+
cmd := []string{"run",
202186
filepath.Join(beatsDir, moduleIncludeListCmdPath),
203187
"-license", toLibbeatLicenseName(BeatLicense),
204188
"-out", options.Outfile, "-buildTags", options.BuildTags,
205189
"-pkg", options.Pkg,
206-
)
190+
}
207191

208192
includeListCmd := sh.RunCmd("go", cmd...)
209193

dev-tools/mage/fmt.go

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,10 @@ func GoImports() error {
6666
}
6767

6868
fmt.Println(">> fmt - goimports: Formatting Go code")
69-
if UseVendor {
70-
if err := gotool.Install(
71-
gotool.Install.Vendored(),
72-
gotool.Install.Package(filepath.Join(GoImportsImportPath)),
73-
); err != nil {
74-
return err
75-
}
76-
} else {
77-
if err := gotool.Install(
78-
gotool.Install.Package(filepath.Join(GoImportsImportPath)),
79-
); err != nil {
80-
return err
81-
}
69+
if err := gotool.Install(
70+
gotool.Install.Package(filepath.Join(GoImportsImportPath)),
71+
); err != nil {
72+
return err
8273
}
8374

8475
args := append(

0 commit comments

Comments
 (0)