Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.1.4 #28

Merged
merged 31 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
80d3221
Add Go 1.19 to testing targets
andyone Aug 17, 2022
da6147b
Bump github.com/essentialkaos/check from 1.3.0 to 1.4.0
dependabot[bot] Mar 9, 2023
e66a60c
Merge pull request #22 from essentialkaos/dependabot/go_modules/devel…
andyone Mar 9, 2023
6989d85
Bump actions/setup-go from 3 to 4
dependabot[bot] Mar 16, 2023
a850fcb
Merge pull request #23 from essentialkaos/dependabot/github_actions/d…
andyone Mar 16, 2023
49a51e8
Bump essentialkaos/aligo-action from 1 to 2
dependabot[bot] Apr 11, 2023
6790bc3
Merge pull request #24 from essentialkaos/dependabot/github_actions/d…
andyone Apr 11, 2023
1e3c331
Improve CI workflow
andyone Apr 11, 2023
fc2cac8
Regenerate Makefile with the latest version of gomakegen
andyone Apr 11, 2023
b39240c
Dependencies update
andyone Apr 11, 2023
8270f61
Update README
andyone Apr 11, 2023
689b239
Improve CI workflow
andyone Apr 11, 2023
2469578
Fix typos
andyone Apr 17, 2023
44ce35d
Improve CI workflow
andyone Apr 17, 2023
26d10c7
Improve CI workflow
andyone Jul 14, 2023
cfbd4f5
Bump actions/checkout from 3 to 4
dependabot[bot] Sep 5, 2023
396ce82
Merge pull request #25 from essentialkaos/dependabot/github_actions/d…
andyone Sep 5, 2023
0479e04
Bump actions/setup-go from 4 to 5
dependabot[bot] Dec 7, 2023
e44360c
Merge pull request #26 from essentialkaos/dependabot/github_actions/d…
andyone Dec 8, 2023
1f0d15c
Bump github/codeql-action from 2 to 3
dependabot[bot] Dec 14, 2023
5ac8893
Merge pull request #27 from essentialkaos/dependabot/github_actions/d…
andyone Dec 14, 2023
292bb82
Regenerate Makefile with the latest version of gomakegen
andyone Jan 19, 2024
e8bdc04
Dependencies update
andyone Jan 19, 2024
4af503a
Update copyright header
andyone Jan 19, 2024
f0c8f9c
Code refactoring
andyone Jan 19, 2024
2de6ea3
Improve CI workflow
andyone Jan 19, 2024
9821afe
Improve dependabot configuration
andyone Jun 14, 2024
6de3dc4
Regenerate Makefile with the latest version of gomakegen
andyone Jun 14, 2024
44e6cce
Improve README
andyone Jun 14, 2024
d15f417
Improve README
andyone Jun 22, 2024
ff50242
Improve CI workflow
andyone Jun 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ updates:
- "andyone"
reviewers:
- "andyone"
groups:
all:
applies-to: version-updates
update-types:
- "minor"
- "patch"

- package-ecosystem: "github-actions"
directory: "/"
Expand Down
5 changes: 5 additions & 0 deletions .github/images/card.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .github/images/godoc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .github/images/license.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 39 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,52 @@ on:
branches: [master, develop]
pull_request:
branches: [master]
workflow_dispatch:
inputs:
force_run:
description: 'Force workflow run'
required: true
type: choice
options: [yes, no]

permissions:
actions: read
contents: read
statuses: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Go:
name: Go
runs-on: ubuntu-latest

env:
SRC_DIR: src/github.com/${{ github.repository }}

strategy:
matrix:
go: [ '1.17.x', '1.18.x' ]
go: [ '1.21.x', '1.22.x' ]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

- name: Checkout
uses: actions/checkout@v3
with:
path: ${{env.SRC_DIR}}

- name: Download dependencies
working-directory: ${{env.SRC_DIR}}
run: make deps-test
run: make deps

- name: Run tests
working-directory: ${{env.SRC_DIR}}
run: go test -covermode=count -coverprofile=cover.out

- name: Send coverage data
uses: essentialkaos/goveralls-action@v1
uses: essentialkaos/goveralls-action@v2
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: ${{env.SRC_DIR}}
profile: cover.out
parallel: true
flag-name: linux-${{ matrix.go }}
Expand All @@ -60,7 +63,7 @@ jobs:

steps:
- name: Finish parallel tests
uses: essentialkaos/goveralls-action@v1
uses: essentialkaos/goveralls-action@v2
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -72,22 +75,30 @@ jobs:

needs: Go

env:
SRC_DIR: src/github.com/${{ github.repository }}

steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.17.x'

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
path: ${{env.SRC_DIR}}
go-version: '1.21.x'

- name: Check Golang sources with Aligo
uses: essentialkaos/aligo-action@v1
uses: essentialkaos/aligo-action@v2
with:
path: ${{env.SRC_DIR}}
files: ./...

Typos:
name: Typos
runs-on: ubuntu-latest

needs: Go

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check spelling
continue-on-error: true
uses: crate-ci/typos@master
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: go

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
2 changes: 2 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[files]
extend-exclude = ["go.sum", "testdata/corpus/*"]
106 changes: 82 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,51 +1,109 @@
################################################################################

# This Makefile generated by GoMakeGen 1.5.1 using next command:
# This Makefile generated by GoMakeGen 3.0.2 using next command:
# gomakegen --mod .
#
# More info: https://kaos.sh/gomakegen

################################################################################

export GO111MODULE=on
ifdef VERBOSE ## Print verbose information (Flag)
VERBOSE_FLAG = -v
endif

.DEFAULT_GOAL := help
.PHONY = fmt vet deps deps-test test gen-fuzz mod-init mod-update mod-vendor help
COMPAT ?= 1.19
MAKEDIR = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
GITREV ?= $(shell test -s $(MAKEDIR)/.git && git rev-parse --short HEAD)

################################################################################

deps: mod-update ## Download dependencies
.DEFAULT_GOAL := help
.PHONY = fmt vet deps update test init vendor gen-fuzz mod-init mod-update mod-download mod-vendor help

deps-test: deps ## Download dependencies for tests
################################################################################

test: ## Run tests
go test -covermode=count .
init: mod-init ## Initialize new module

gen-fuzz: ## Generate archives for fuzz testing
which go-fuzz-build &>/dev/null || go get -u -v github.com/dvyukov/go-fuzz/go-fuzz-build
go-fuzz-build -o fuzz.zip github.com/essentialkaos/go-zabbix
deps: mod-download ## Download dependencies

update: mod-update ## Update dependencies to the latest versions

mod-init: ## Initialize new module
go mod init
go mod tidy
vendor: mod-vendor ## Make vendored copy of dependencies

mod-update: ## Download modules to local cache
go mod download
test: ## Run tests
@echo "Starting tests…"
ifdef COVERAGE_FILE ## Save coverage data into file (String)
@go test $(VERBOSE_FLAG) -covermode=count -coverprofile=$(COVERAGE_FILE) .
else
@go test $(VERBOSE_FLAG) -covermode=count .
endif

mod-vendor: ## Make vendored copy of dependencies
go mod vendor
gen-fuzz: ## Generate archives for fuzz testing
@which go-fuzz-build &>/dev/null || go get -u -v github.com/dvyukov/go-fuzz/go-fuzz-build
@echo "Generating fuzzing data…"
@go-fuzz-build -o fuzz.zip github.com/essentialkaos/go-zabbix

mod-init:
@echo "[1/2] Modules initialization…"
ifdef MODULE_PATH ## Module path for initialization (String)
@go mod init $(MODULE_PATH)
else
@go mod init
endif

@echo "[2/2] Dependencies cleanup…"
ifdef COMPAT ## Compatible Go version (String)
@go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT) -go=$(COMPAT)
else
@go mod tidy $(VERBOSE_FLAG)
endif

mod-update:
@echo "[1/4] Updating dependencies…"
ifdef UPDATE_ALL ## Update all dependencies (Flag)
@go get -u $(VERBOSE_FLAG) all
else
@go get -u $(VERBOSE_FLAG) ./...
endif

@echo "[2/4] Stripping toolchain info…"
@grep -q 'toolchain ' go.mod && go mod edit -toolchain=none || :

@echo "[3/4] Dependencies cleanup…"
ifdef COMPAT
@go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT)
else
@go mod tidy $(VERBOSE_FLAG)
endif

@echo "[4/4] Updating vendored dependencies…"
@test -d vendor && rm -rf vendor && go mod vendor $(VERBOSE_FLAG) || :

mod-download:
@echo "Downloading dependencies…"
@go mod download

mod-vendor:
@echo "Vendoring dependencies…"
@rm -rf vendor && go mod vendor $(VERBOSE_FLAG) || :

fmt: ## Format source code with gofmt
find . -name "*.go" -exec gofmt -s -w {} \;
@echo "Formatting sources…"
@find . -name "*.go" -exec gofmt -s -w {} \;

vet: ## Runs go vet over sources
go vet -composites=false -printfuncs=LPrintf,TLPrintf,TPrintf,log.Debug,log.Info,log.Warn,log.Error,log.Critical,log.Print ./...
vet: ## Runs 'go vet' over sources
@echo "Running 'go vet' over sources…"
@go vet -composites=false -printfuncs=LPrintf,TLPrintf,TPrintf,log.Debug,log.Info,log.Warn,log.Error,log.Critical,log.Print ./...

help: ## Show this info
@echo -e '\n\033[1mSupported targets:\033[0m\n'
@echo -e '\n\033[1mTargets:\033[0m\n'
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[33m%-12s\033[0m %s\n", $$1, $$2}'
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[33m%-8s\033[0m %s\n", $$1, $$2}'
@echo -e '\n\033[1mVariables:\033[0m\n'
@grep -E '^ifdef [A-Z_]+ .*?## .*$$' $(abspath $(lastword $(MAKEFILE_LIST))) \
| sed 's/ifdef //' \
| awk 'BEGIN {FS = " .*?## "}; {printf " \033[32m%-13s\033[0m %s\n", $$1, $$2}'
@echo -e ''
@echo -e '\033[90mGenerated by GoMakeGen 1.5.1\033[0m\n'
@echo -e '\033[90mGenerated by GoMakeGen 3.0.2\033[0m\n'

################################################################################
25 changes: 5 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,20 @@
<p align="center"><a href="#readme"><img src="https://gh.kaos.st/go-zabbix.svg"/></a></p>
<p align="center"><a href="#readme"><img src=".github/images/card.svg"/></a></p>

<p align="center">
<a href="https://kaos.sh/g/go-zabbix"><img src="https://gh.kaos.st/godoc.svg" alt="PkgGoDev" /></a>
<a href="https://kaos.sh/r/go-zabbix"><img src="https://kaos.sh/r/go-zabbix.svg" alt="GoReportCard" /></a>
<a href="https://kaos.sh/g/go-zabbix"><img src=".github/images/godoc.svg"/></a>
<a href="https://kaos.sh/w/go-zabbix/ci"><img src="https://kaos.sh/w/go-zabbix/ci.svg" alt="GitHub Actions CI Status" /></a>
<a href="https://kaos.sh/w/go-zabbix/codeql"><img src="https://kaos.sh/w/go-zabbix/codeql.svg" alt="GitHub Actions CodeQL Status" /></a>
<a href="https://kaos.sh/c/go-zabbix"><img src="https://kaos.sh/c/go-zabbix.svg" alt="Coverage Status" /></a>
<a href="https://kaos.sh/b/go-zabbix"><img src="https://kaos.sh/b/e3257f5f-8f63-4d80-92d0-e083713efbed.svg" alt="Codebeat badge" /></a>
<a href="#license"><img src="https://gh.kaos.st/apache2.svg"></a>
<a href="#license"><img src=".github/images/license.svg"/></a>
</p>

<p align="center"><a href="#installation">Installation</a> • <a href="#zabbix-version-support">Zabbix version support</a> • <a href="#build-status">Build Status</a> • <a href="#license">License</a></p>
<p align="center"><a href="#zabbix-version-support">Zabbix version support</a> • <a href="#ci-status">CI Status</a> • <a href="#license">License</a></p>

<br/>

`zabbix` is a Go package for sending metrics data to Zabbix Server 3+.

### Installation

Make sure you have a working Go 1.17+ workspace (_[instructions](https://golang.org/doc/install)_), then:

```
go get -d github.com/essentialkaos/go-zabbix
```

For update to the latest stable release, do:

```
go get -d -u github.com/essentialkaos/go-zabbix
```

### Zabbix version support

| Zabbix Version | Support Status |
Expand All @@ -41,7 +26,7 @@ go get -d -u github.com/essentialkaos/go-zabbix
| `5.x` | Yes (_Full_) |
| `6.x` | Yes (_Full_) |

### Build Status
### CI Status

| Branch | Status |
|--------|--------|
Expand Down
2 changes: 1 addition & 1 deletion example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package zabbix

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2024 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion fuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package zabbix

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2024 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/essentialkaos/go-zabbix

go 1.17
go 1.18

require github.com/essentialkaos/check v1.3.0
require github.com/essentialkaos/check v1.4.0

require (
github.com/kr/pretty v0.3.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.6.1 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
)
Loading