Skip to content

Commit

Permalink
Remove dependency on libbeat (#344)
Browse files Browse the repository at this point in the history
* Moves golangci-lint to macos workers, so CGO can be enabled for the jobs
* Adds refactoring of metrics setup, so it no longer depends on libbeat
* NOTICE.txt file is updated with new dependencies
* Several minor issues (reported by golanglint-ci) are fixed
  • Loading branch information
kvch authored Apr 28, 2022
1 parent ee20b15 commit a950518
Show file tree
Hide file tree
Showing 60 changed files with 1,554 additions and 525 deletions.
1 change: 0 additions & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
include:
- GOOS: windows
- GOOS: linux
- GOOS: darwin
name: lint
runs-on: ubuntu-latest
steps:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,38 @@ on:
- 8.*

jobs:
golangci:
runs-on: macos-latest
name: lint
steps:
- uses: actions/checkout@v2
- name: Fetch Go version from .go-version
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV
- uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: golangci-lint
env:
CGO_ENABLED: 1
uses: golangci/golangci-lint-action@v2
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.44.2

# Give the job more time to execute.
# Regarding `--whole-files`, the linter is supposed to support linting of changed a patch only but,
# for some reason, it's very unreliable this way - sometimes it does not report any or some
# issues without linting the whole files, so we have to use `--whole-files`
# which can lead to some frustration from developers who would like to
# fix a single line in an existing codebase and the linter would force them
# into fixing all linting issues in the whole file instead.
args: --timeout=30m --whole-files

# Optional: if set to true then the action will use pre-installed Go.
skip-go-installation: true

# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: true
macos:
runs-on: macos-latest
steps:
Expand Down
9 changes: 9 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ linters:
# 'replace' is used in go.mod for many dependencies that come from libbeat. We should work to remove those,
# so we can re-enable this linter.
# - gomoddirectives # manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.
- gomodguard
- gosimple # linter for Go source code that specializes in simplifying a code
- misspell # finds commonly misspelled English words in comments
- nakedret # finds naked returns in functions greater than a specified function length
Expand Down Expand Up @@ -100,6 +101,14 @@ linters-settings:
# Allow local `replace` directives. Default is false.
replace-local: false

gomodguard:
blocked:
# List of blocked modules.
modules:
- github.com/elastic/beats/v7:
reason: "There must be no Beats dependency, use elastic-agent-libs instead."


gosimple:
# Select the Go version to target. The default is '1.13'.
go: "1.17"
Expand Down
942 changes: 893 additions & 49 deletions NOTICE.txt

Large diffs are not rendered by default.

26 changes: 15 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ require (
github.com/coreos/go-systemd/v22 v22.3.2
github.com/docker/go-units v0.4.0
github.com/elastic/e2e-testing v1.99.2-0.20220117192005-d3365c99b9c4
github.com/elastic/elastic-agent-autodiscover v0.0.0-20220404145827-89887023c1ab
github.com/elastic/elastic-agent-client/v7 v7.0.0-20210727140539-f0905d9377f6
github.com/elastic/elastic-agent-libs v0.2.1
github.com/elastic/elastic-agent-system-metrics v0.1.0
github.com/elastic/go-licenser v0.4.0
github.com/elastic/go-sysinfo v1.7.1
github.com/elastic/go-ucfg v0.8.4
Expand All @@ -38,21 +40,21 @@ require (
github.com/spf13/cobra v1.3.0
github.com/stretchr/testify v1.7.0
github.com/tsg/go-daemon v0.0.0-20200207173439-e704b93fd89b
go.elastic.co/ecszap v1.0.0
go.elastic.co/ecszap v1.0.1
go.elastic.co/go-licence-detector v0.5.0
go.uber.org/zap v1.21.0
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
golang.org/x/sys v0.0.0-20220209214540-3681064d5158
golang.org/x/sys v0.0.0-20220405052023-b1e9470b6e64
golang.org/x/tools v0.1.9
google.golang.org/grpc v1.42.0
google.golang.org/protobuf v1.27.1
gopkg.in/yaml.v2 v2.4.0
gotest.tools v2.2.0+incompatible
gotest.tools/gotestsum v1.7.0
k8s.io/api v0.23.1
k8s.io/apimachinery v0.23.1
k8s.io/client-go v0.23.1
k8s.io/api v0.23.4
k8s.io/apimachinery v0.23.4
k8s.io/client-go v0.23.4
)

require (
Expand All @@ -65,7 +67,7 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dnephin/pflag v1.0.7 // indirect
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/docker v20.10.7+incompatible // indirect
github.com/docker/docker v20.10.12+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/elastic/go-structform v0.0.9 // indirect
github.com/elastic/go-windows v1.0.1 // indirect
Expand All @@ -82,7 +84,7 @@ require (
github.com/google/licenseclassifier v0.0.0-20200402202327-879cb1424de0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jcchavezs/porto v0.1.0 // indirect
Expand All @@ -109,14 +111,16 @@ require (
github.com/tklauser/numcpus v0.3.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.elastic.co/apm/module/apmhttp v1.15.0 // indirect
go.elastic.co/apm/module/apmhttp/v2 v2.0.0 // indirect
go.elastic.co/apm/v2 v2.0.0 // indirect
go.elastic.co/fastjson v1.1.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
Expand All @@ -127,9 +131,9 @@ require (
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
howett.net/plist v1.0.0 // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b // indirect
k8s.io/utils v0.0.0-20211116205334-6203023598ed // indirect
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)

Expand Down
Loading

0 comments on commit a950518

Please sign in to comment.