Skip to content

Commit

Permalink
set min go version to 1.21
Browse files Browse the repository at this point in the history
get rid of some deprecations
  • Loading branch information
brainexe committed Dec 2, 2024
1 parent 02ae37b commit d747089
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 21 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ jobs:
strategy:
matrix:
go:
- ^1.19
- ^1.20
- ^1.21
- ^1.22
- ^1.23
steps:

- name: Set up Go 1.x
Expand Down Expand Up @@ -96,12 +97,14 @@ jobs:
strategy:
matrix:
os:
- debian:9
- debian:10
- ubuntu:18.04
- debian:11
- debian:12
- debian:13
- ubuntu:20.04
- centos:7
- ubuntu:22.04
- ubuntu:24.04
- centos:8
- centos:9

steps:
- name: Download artifact
Expand Down
10 changes: 5 additions & 5 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"time"
)

// Client is a class wich sends metrics to the carbon receivers
// Client is a class which sends metrics to the carbon receivers
type Client struct {
// User config.
Conf *Config
Expand Down Expand Up @@ -137,9 +137,9 @@ func (c *Client) tryToSendToGraphite(metric string, carbonAddr string, conn net.
}

// Run go routine per carbon server to:
// 1) Send data from retryFile to a carbon
// 2) Send metrics from monitoring channel to a carbon
// 3) Send metrics from the main channel to carbon
// 1. Send data from retryFile to a carbon
// 2. Send metrics from monitoring channel to a carbon
// 3. Send metrics from the main channel to carbon
//
// And save everything to the retryFile on any error
func (c Client) runBackend(carbonAddr string) {
Expand Down Expand Up @@ -235,7 +235,7 @@ func (c Client) runBackend(carbonAddr string) {
}
}

//Run a client, which:
// Run a client, which:
// 1) Make monitoring and main channels per carbon server
// 2) Launchs go routine per carbon server
// 3) Copy metrics from monitoring and main channels to the carbon server specific
Expand Down
2 changes: 1 addition & 1 deletion config_linux.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !noacl
//go:build !noacl

package grafsy

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module github.com/leoleovich/grafsy

go 1.14
go 1.21

require (
github.com/BurntSushi/toml v0.3.1
github.com/BurntSushi/toml v1.4.0
github.com/naegelejd/go-acl v0.0.0-20200406162857-ebe394c522e5
github.com/pkg/errors v0.9.1
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/naegelejd/go-acl v0.0.0-20200406162857-ebe394c522e5 h1:R10+S1Knv6udBjyDYU84+zD5R8qLWg7wSH/ddhJSzX4=
github.com/naegelejd/go-acl v0.0.0-20200406162857-ebe394c522e5/go.mod h1:nMzsOoQWESVMF6s+hAF8Qnc14fUIpL7pfmGm6MV8B2g=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down
12 changes: 7 additions & 5 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package grafsy
import (
"bufio"
"fmt"
"io/ioutil"
"net"
"os"
"strconv"
Expand Down Expand Up @@ -173,16 +172,19 @@ func (s Server) handleRequest(conn net.Conn) {
// This is a second way how to send metrics, except network.
func (s Server) handleDirMetrics() {
for ; ; time.Sleep(time.Duration(s.Conf.ClientSendInterval) * time.Second) {
files, err := ioutil.ReadDir(s.Conf.MetricDir)
entries, err := os.ReadDir(s.Conf.MetricDir)
if err != nil {
panic(err.Error())
}
for _, f := range files {
resultsList, _ := readMetricsFromFile(s.Conf.MetricDir + "/" + f.Name())
for _, entry := range entries {
info, err := entry.Info()
if err != nil {
panic(err.Error())
}
resultsList, _ := readMetricsFromFile(s.Conf.MetricDir + "/" + info.Name())
s.Mon.Increase(&s.Mon.serverStat.dir, len(resultsList))
s.cleanAndUseIncomingData(resultsList)
}

}
}

Expand Down

0 comments on commit d747089

Please sign in to comment.