From f0c8f9cb96a101253dffb6db589e898b432dd648 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Fri, 19 Jan 2024 12:06:20 +0300 Subject: [PATCH] Code refactoring --- zabbix.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zabbix.go b/zabbix.go index 4c9de37..2097e3d 100644 --- a/zabbix.go +++ b/zabbix.go @@ -50,7 +50,7 @@ func NewClient(address, hostname string) (*Client, error) { // ////////////////////////////////////////////////////////////////////////////////// // // Add adds new metric to stack -func (c *Client) Add(key string, value interface{}) *Metric { +func (c *Client) Add(key string, value any) *Metric { now := time.Now() metric := &Metric{ id: len(c.data), @@ -162,7 +162,7 @@ func writeToConnection(conn *net.TCPConn, data []byte, timeout time.Duration) er } // formatValue convert value to string -func formatValue(v interface{}) string { +func formatValue(v any) string { switch t := v.(type) { case float32: return fmt.Sprintf("%.6f", t)