-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
golangci-lint: Fix some trivial issues #53
Open
mjtrangoni
wants to merge
8
commits into
zabbix-tools:master
Choose a base branch
from
mjtrangoni:fix-some-lint-errors
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Signed-off-by: Mario Trangoni <[email protected]>
Signed-off-by: Mario Trangoni <[email protected]>
Signed-off-by: Mario Trangoni <[email protected]>
cavaliercoder
approved these changes
Feb 3, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good thank you! Please proceed.
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.