Skip to content

Commit 26cd498

Browse files
authored
Merge pull request #28 from essentialkaos/develop
Version 1.1.4
2 parents 0327604 + ff50242 commit 26cd498

16 files changed

+165
-99
lines changed

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ updates:
1414
- "andyone"
1515
reviewers:
1616
- "andyone"
17+
groups:
18+
all:
19+
applies-to: version-updates
20+
update-types:
21+
- "minor"
22+
- "patch"
1723

1824
- package-ecosystem: "github-actions"
1925
directory: "/"

.github/images/card.svg

+5
Loading

.github/images/godoc.svg

+1
Loading

.github/images/license.svg

+1
Loading

.github/workflows/ci.yml

+39-28
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,52 @@ on:
55
branches: [master, develop]
66
pull_request:
77
branches: [master]
8+
workflow_dispatch:
9+
inputs:
10+
force_run:
11+
description: 'Force workflow run'
12+
required: true
13+
type: choice
14+
options: [yes, no]
815

916
permissions:
1017
actions: read
1118
contents: read
1219
statuses: write
1320

21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.ref }}
23+
cancel-in-progress: true
24+
1425
jobs:
1526
Go:
1627
name: Go
1728
runs-on: ubuntu-latest
1829

19-
env:
20-
SRC_DIR: src/github.com/${{ github.repository }}
21-
2230
strategy:
2331
matrix:
24-
go: [ '1.17.x', '1.18.x' ]
32+
go: [ '1.21.x', '1.22.x' ]
2533

2634
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
2738
- name: Set up Go
28-
uses: actions/setup-go@v3
39+
uses: actions/setup-go@v5
2940
with:
3041
go-version: ${{ matrix.go }}
3142

32-
- name: Checkout
33-
uses: actions/checkout@v3
34-
with:
35-
path: ${{env.SRC_DIR}}
36-
3743
- name: Download dependencies
38-
working-directory: ${{env.SRC_DIR}}
39-
run: make deps-test
44+
run: make deps
4045

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

4549
- name: Send coverage data
46-
uses: essentialkaos/goveralls-action@v1
50+
uses: essentialkaos/goveralls-action@v2
4751
env:
4852
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4953
with:
50-
path: ${{env.SRC_DIR}}
5154
profile: cover.out
5255
parallel: true
5356
flag-name: linux-${{ matrix.go }}
@@ -60,7 +63,7 @@ jobs:
6063

6164
steps:
6265
- name: Finish parallel tests
63-
uses: essentialkaos/goveralls-action@v1
66+
uses: essentialkaos/goveralls-action@v2
6467
env:
6568
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6669
with:
@@ -72,22 +75,30 @@ jobs:
7275

7376
needs: Go
7477

75-
env:
76-
SRC_DIR: src/github.com/${{ github.repository }}
77-
7878
steps:
79-
- name: Set up Go
80-
uses: actions/setup-go@v3
81-
with:
82-
go-version: '1.17.x'
83-
8479
- name: Checkout
85-
uses: actions/checkout@v3
80+
uses: actions/checkout@v4
81+
82+
- name: Set up Go
83+
uses: actions/setup-go@v5
8684
with:
87-
path: ${{env.SRC_DIR}}
85+
go-version: '1.21.x'
8886

8987
- name: Check Golang sources with Aligo
90-
uses: essentialkaos/aligo-action@v1
88+
uses: essentialkaos/aligo-action@v2
9189
with:
92-
path: ${{env.SRC_DIR}}
9390
files: ./...
91+
92+
Typos:
93+
name: Typos
94+
runs-on: ubuntu-latest
95+
96+
needs: Go
97+
98+
steps:
99+
- name: Checkout
100+
uses: actions/checkout@v4
101+
102+
- name: Check spelling
103+
continue-on-error: true
104+
uses: crate-ci/typos@master

.github/workflows/codeql.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ jobs:
2020

2121
steps:
2222
- name: Checkout repository
23-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
2424
with:
2525
fetch-depth: 2
2626

2727
- name: Initialize CodeQL
28-
uses: github/codeql-action/init@v2
28+
uses: github/codeql-action/init@v3
2929
with:
3030
languages: go
3131

3232
- name: Perform CodeQL Analysis
33-
uses: github/codeql-action/analyze@v2
33+
uses: github/codeql-action/analyze@v3

.typos.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[files]
2+
extend-exclude = ["go.sum", "testdata/corpus/*"]

Makefile

+82-24
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,109 @@
11
################################################################################
22

3-
# This Makefile generated by GoMakeGen 1.5.1 using next command:
3+
# This Makefile generated by GoMakeGen 3.0.2 using next command:
44
# gomakegen --mod .
55
#
66
# More info: https://kaos.sh/gomakegen
77

88
################################################################################
99

10-
export GO111MODULE=on
10+
ifdef VERBOSE ## Print verbose information (Flag)
11+
VERBOSE_FLAG = -v
12+
endif
1113

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

1518
################################################################################
1619

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

19-
deps-test: deps ## Download dependencies for tests
23+
################################################################################
2024

21-
test: ## Run tests
22-
go test -covermode=count .
25+
init: mod-init ## Initialize new module
2326

24-
gen-fuzz: ## Generate archives for fuzz testing
25-
which go-fuzz-build &>/dev/null || go get -u -v github.com/dvyukov/go-fuzz/go-fuzz-build
26-
go-fuzz-build -o fuzz.zip github.com/essentialkaos/go-zabbix
27+
deps: mod-download ## Download dependencies
28+
29+
update: mod-update ## Update dependencies to the latest versions
2730

28-
mod-init: ## Initialize new module
29-
go mod init
30-
go mod tidy
31+
vendor: mod-vendor ## Make vendored copy of dependencies
3132

32-
mod-update: ## Download modules to local cache
33-
go mod download
33+
test: ## Run tests
34+
@echo "Starting tests…"
35+
ifdef COVERAGE_FILE ## Save coverage data into file (String)
36+
@go test $(VERBOSE_FLAG) -covermode=count -coverprofile=$(COVERAGE_FILE) .
37+
else
38+
@go test $(VERBOSE_FLAG) -covermode=count .
39+
endif
3440

35-
mod-vendor: ## Make vendored copy of dependencies
36-
go mod vendor
41+
gen-fuzz: ## Generate archives for fuzz testing
42+
@which go-fuzz-build &>/dev/null || go get -u -v github.com/dvyukov/go-fuzz/go-fuzz-build
43+
@echo "Generating fuzzing data…"
44+
@go-fuzz-build -o fuzz.zip github.com/essentialkaos/go-zabbix
45+
46+
mod-init:
47+
@echo "[1/2] Modules initialization…"
48+
ifdef MODULE_PATH ## Module path for initialization (String)
49+
@go mod init $(MODULE_PATH)
50+
else
51+
@go mod init
52+
endif
53+
54+
@echo "[2/2] Dependencies cleanup…"
55+
ifdef COMPAT ## Compatible Go version (String)
56+
@go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT) -go=$(COMPAT)
57+
else
58+
@go mod tidy $(VERBOSE_FLAG)
59+
endif
60+
61+
mod-update:
62+
@echo "[1/4] Updating dependencies…"
63+
ifdef UPDATE_ALL ## Update all dependencies (Flag)
64+
@go get -u $(VERBOSE_FLAG) all
65+
else
66+
@go get -u $(VERBOSE_FLAG) ./...
67+
endif
68+
69+
@echo "[2/4] Stripping toolchain info…"
70+
@grep -q 'toolchain ' go.mod && go mod edit -toolchain=none || :
71+
72+
@echo "[3/4] Dependencies cleanup…"
73+
ifdef COMPAT
74+
@go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT)
75+
else
76+
@go mod tidy $(VERBOSE_FLAG)
77+
endif
78+
79+
@echo "[4/4] Updating vendored dependencies…"
80+
@test -d vendor && rm -rf vendor && go mod vendor $(VERBOSE_FLAG) || :
81+
82+
mod-download:
83+
@echo "Downloading dependencies…"
84+
@go mod download
85+
86+
mod-vendor:
87+
@echo "Vendoring dependencies…"
88+
@rm -rf vendor && go mod vendor $(VERBOSE_FLAG) || :
3789

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

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

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

51109
################################################################################

README.md

+5-20
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,20 @@
1-
<p align="center"><a href="#readme"><img src="https://gh.kaos.st/go-zabbix.svg"/></a></p>
1+
<p align="center"><a href="#readme"><img src=".github/images/card.svg"/></a></p>
22

33
<p align="center">
4-
<a href="https://kaos.sh/g/go-zabbix"><img src="https://gh.kaos.st/godoc.svg" alt="PkgGoDev" /></a>
5-
<a href="https://kaos.sh/r/go-zabbix"><img src="https://kaos.sh/r/go-zabbix.svg" alt="GoReportCard" /></a>
4+
<a href="https://kaos.sh/g/go-zabbix"><img src=".github/images/godoc.svg"/></a>
65
<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>
76
<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>
87
<a href="https://kaos.sh/c/go-zabbix"><img src="https://kaos.sh/c/go-zabbix.svg" alt="Coverage Status" /></a>
98
<a href="https://kaos.sh/b/go-zabbix"><img src="https://kaos.sh/b/e3257f5f-8f63-4d80-92d0-e083713efbed.svg" alt="Codebeat badge" /></a>
10-
<a href="#license"><img src="https://gh.kaos.st/apache2.svg"></a>
9+
<a href="#license"><img src=".github/images/license.svg"/></a>
1110
</p>
1211

13-
<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>
12+
<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>
1413

1514
<br/>
1615

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

19-
### Installation
20-
21-
Make sure you have a working Go 1.17+ workspace (_[instructions](https://golang.org/doc/install)_), then:
22-
23-
```
24-
go get -d github.com/essentialkaos/go-zabbix
25-
```
26-
27-
For update to the latest stable release, do:
28-
29-
```
30-
go get -d -u github.com/essentialkaos/go-zabbix
31-
```
32-
3318
### Zabbix version support
3419

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

44-
### Build Status
29+
### CI Status
4530

4631
| Branch | Status |
4732
|--------|--------|

example_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package zabbix
22

33
// ////////////////////////////////////////////////////////////////////////////////// //
44
// //
5-
// Copyright (c) 2022 ESSENTIAL KAOS //
5+
// Copyright (c) 2024 ESSENTIAL KAOS //
66
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
77
// //
88
// ////////////////////////////////////////////////////////////////////////////////// //

fuzz.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package zabbix
44

55
// ////////////////////////////////////////////////////////////////////////////////// //
66
// //
7-
// Copyright (c) 2022 ESSENTIAL KAOS //
7+
// Copyright (c) 2024 ESSENTIAL KAOS //
88
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
99
// //
1010
// ////////////////////////////////////////////////////////////////////////////////// //

go.mod

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module github.com/essentialkaos/go-zabbix
22

3-
go 1.17
3+
go 1.18
44

5-
require github.com/essentialkaos/check v1.3.0
5+
require github.com/essentialkaos/check v1.4.0
66

77
require (
8-
github.com/kr/pretty v0.3.0 // indirect
8+
github.com/kr/pretty v0.3.1 // indirect
99
github.com/kr/text v0.2.0 // indirect
10-
github.com/rogpeppe/go-internal v1.6.1 // indirect
10+
github.com/rogpeppe/go-internal v1.12.0 // indirect
1111
)

0 commit comments

Comments
 (0)