aboutsummaryrefslogtreecommitdiff
path: root/tagpreprocessor.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-08-14 01:02:32 +0700
committerShulhan <ms@kilabit.info>2022-08-14 14:49:23 +0700
commit2965b17ccc24abde2346c20ee1f9384ae6e12f20 (patch)
tree1e656f22c28454d1199d75e3b0e504d38b582218 /tagpreprocessor.go
parent97cdab5a7b6f2d37a53c55045e90c230c6c959ad (diff)
downloadhaminer-2965b17ccc24abde2346c20ee1f9384ae6e12f20.tar.xz
all: update the go.mod
Set the minimum Go to 1.18 and update the share modules. When this program written, the ini library does not have the Unmarshal function, so we load the configuration by reading each key and parse it manually. Now that we have Unmarshal function, the way we parse the configuration is simplified so does the way configuration written. This changes the accept_backend, capture_request_header written. Instead of using comma to set multiple values, now it must be written one key and one value on different line.
Diffstat (limited to 'tagpreprocessor.go')
-rw-r--r--tagpreprocessor.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/tagpreprocessor.go b/tagpreprocessor.go
index 2be8846..64a9bec 100644
--- a/tagpreprocessor.go
+++ b/tagpreprocessor.go
@@ -5,7 +5,6 @@
package haminer
import (
- "errors"
"regexp"
"strings"
)
@@ -16,11 +15,9 @@ type tagPreprocessor struct {
repl string
}
-//
// newTagPreprocessor create and initialize replace tag pre-processing.
// The regex and repl strings must be enclosed with double-quote, except for
// repl it can be empty.
-//
func newTagPreprocessor(name, regex, repl string) (
retag *tagPreprocessor, err error,
) {
@@ -29,10 +26,10 @@ func newTagPreprocessor(name, regex, repl string) (
repl = strings.TrimSpace(repl)
if len(name) == 0 {
- return nil, errors.New("newTagPreprocessor: empty name parameter")
+ return nil, nil
}
if len(regex) == 0 {
- return nil, errors.New("newTagPreprocessor: empty regex parameter")
+ return nil, nil
}
re, err := regexp.Compile(regex)