summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2024-02-07 19:14:47 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2024-02-07 19:14:47 +0100
commita457621e444b4e0719c076a172a62d823616a122 (patch)
treedf052ecf303a23d25f7300bd6e5db13fa2797805 /util
parentdf50aaee6c6ef4b51638fe22317e28234ffe8acc (diff)
downloadkafka-sandbox-a457621e444b4e0719c076a172a62d823616a122.tar.gz
kafka-sandbox-a457621e444b4e0719c076a172a62d823616a122.tar.bz2
kafka-sandbox-a457621e444b4e0719c076a172a62d823616a122.tar.xz
kafka-sandbox-a457621e444b4e0719c076a172a62d823616a122.zip
wip
Diffstat (limited to 'util')
-rw-r--r--util/util.go41
1 files changed, 0 insertions, 41 deletions
diff --git a/util/util.go b/util/util.go
deleted file mode 100644
index d56f662..0000000
--- a/util/util.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package util
-
-import (
- "bufio"
- "fmt"
- "os"
- "strings"
-
- "github.com/confluentinc/confluent-kafka-go/v2/kafka"
-)
-
-func ReadConfig(configFile string) kafka.ConfigMap {
- m := make(map[string]kafka.ConfigValue)
-
- file, err := os.Open(configFile)
- if err != nil {
- fmt.Fprintf(os.Stderr, "Failed to open file: %s", err)
- os.Exit(1)
- }
- defer file.Close()
-
- scanner := bufio.NewScanner(file)
- for scanner.Scan() {
- line := strings.TrimSpace(scanner.Text())
- if !strings.HasPrefix(line, "#") && len(line) != 0 {
- before, after, found := strings.Cut(line, "=")
- if found {
- parameter := strings.TrimSpace(before)
- value := strings.TrimSpace(after)
- m[parameter] = value
- }
- }
- }
-
- if err := scanner.Err(); err != nil {
- fmt.Printf("Failed to read file: %s", err)
- os.Exit(1)
- }
-
- return m
-}