golangci-lint: Fix some trivial issues#53
Open
mjtrangoni wants to merge 8 commits intozabbix-tools:masterfrom
Open
golangci-lint: Fix some trivial issues#53mjtrangoni wants to merge 8 commits intozabbix-tools:masterfrom
mjtrangoni wants to merge 8 commits intozabbix-tools:masterfrom
Conversation
See,
bool.go:17:10: S1028: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...)) (gosimple)
return errors.New(fmt.Sprintf("Boolean unmarshal error: invalid input %s", asString))
^
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
See,
debug.go:9:11: var-declaration: should omit type bool from declaration of var debug; it will be inferred from the right-hand side (revive)
var debug bool = (os.Getenv("ZBX_DEBUG") == "1")
^
maintenance.go:145:1: receiver-naming: receiver name c should be consistent with previous receiver name m for MaintenanceCreateParams (revive)
func (c *MaintenanceCreateParams) FillFields(Object *Maintenance) *MaintenanceCreateParams {
c.ActiveSince = Object.ActiveSince.Unix()
c.ActiveTill = Object.ActiveSince.Add(time.Hour * time.Duration(Object.ServicePeriod)).Unix()
c.Description = Object.Description
c.MaintenanceID = Object.MaintenanceID
c.Name = Object.Name
c.TagsEvaltype = int(Object.Type)
c.MaintenanceType = int(Object.ActionEvalTypeAndOr)
return c
}
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
See,
client_builder_test.go:5:2: SA1019: "io/ioutil" has been deprecated since Go 1.16: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details. (staticcheck)
"io/ioutil"
^
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
See,
maintenance.go:134:7: SA6005: should use strings.EqualFold instead (staticcheck)
if strings.ToUpper(strings.Trim(host.Hostname, " ")) == strings.ToUpper(strings.Trim(name, " ")) {
^
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
See, time.go:15:23: SA5009: Printf format %s has arg zabbix-tools#1 of wrong type int64 (staticcheck) stamp := fmt.Sprintf("\"%s\"", t.Unix()) ^ Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
cavaliercoder
approved these changes
Feb 3, 2023
Collaborator
cavaliercoder
left a comment
There was a problem hiding this comment.
Looks good thank you! Please proceed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @cavaliercoder,
This PR fix some trivial issues detected by golangci-lint. If you agree I can go further and fix the non-trivial ones in a separate PR, adding also a CI check.