Skip to content

Add linter #272

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

Merged
merged 4 commits into from
Dec 3, 2024
Merged

Add linter #272

merged 4 commits into from
Dec 3, 2024

Conversation

dricross
Copy link
Contributor

@dricross dricross commented Dec 2, 2024

Issue #, if available:

Description of changes:

Here are the errors

/local/home/dricross/workplace/amazon-cloudwatch-agent-operator/bin/golangci-lint run
controllers/common.go:124:20: ineffectual assignment to err (ineffassign)
        desiredObjectMap, err := reconcileDesiredObjectUIDs(ctx, kubeClient, logger, &owner, scheme, desiredObjects...)
                          ^
internal/manifests/collector/suite_test.go:122:6: func `newParams` is unused (unused)
func newParams(taContainerImage string, file string) (manifests.Params, error) {
     ^
internal/manifests/collector/ports.go:73:3: S1011: should replace loop with `ports = append(ports, plist...)` (gosimple)
                for _, p := range plist {
                ^
internal/manifests/collector/ports_test.go:128:2: SA4017: Replace doesn't have side effects and its return value is ignored (staticcheck)
        strings.Replace(cfg, "2800", "2000", 1)
        ^
internal/manifests/collector/ports_test.go:140:2: SA4017: Replace doesn't have side effects and its return value is ignored (staticcheck)
        strings.Replace(cfg, "2900", "2000", 1)
        ^
internal/manifests/collector/ports_test.go:156:2: SA4017: Replace doesn't have side effects and its return value is ignored (staticcheck)
        strings.Replace(cfg, "2900", "2000", 1)
        ^
pkg/instrumentation/podmutator.go:32:2: var `errNoInstancesAvailable` is unused (unused)
        errNoInstancesAvailable      = errors.New("no OpenTelemetry Instrumentation instances available")
        ^
cmd/amazon-cloudwatch-agent-target-allocator/watcher/promOperator.go:289:51: SA1019: endp.BearerTokenSecret is deprecated: use `authorization` instead. (staticcheck)
                if err = store.AddBearerToken(ctx, smNamespace, endp.BearerTokenSecret, objKey); err != nil {
                                                                ^
cmd/amazon-cloudwatch-agent-target-allocator/watcher/promOperator.go:332:52: SA1019: endp.BearerTokenSecret is deprecated: use `authorization` instead. (staticcheck)
                if err = store.AddBearerToken(ctx, pmNamespace, &endp.BearerTokenSecret, objKey); err != nil {
                                                                 ^
integration-tests/manifests/annotations/validate_annotation_methods.go:189:6: S1002: should omit comparison to bool constant, can be simplified to `correct` (gosimple)
                if correct == true {
                   ^
integration-tests/manifests/annotations/validate_annotation_methods.go:203:14: ineffectual assignment to err (ineffassign)
        deployment, err = clientSet.AppsV1().Deployments(amazonCloudwatchNamespace).Get(context.TODO(), amazonControllerManager, metav1.GetOptions{})
                    ^
integration-tests/manifests/annotations/validate_annotation_methods.go:296:3: ineffectual assignment to indexOfAutoAnnotationConfigString (ineffassign)
                indexOfAutoAnnotationConfigString = len(deployment.Spec.Template.Spec.Containers[0].Args) - 1
                ^
integration-tests/manifests/annotations/validate_annotations_namespace_test.go:270:2: ineffectual assignment to startTime (ineffassign)
        startTime := time.Now()
        ^
integration-tests/manifests/annotations/validate_annotations_namespace_test.go:310:2: SA4006: this value of `err` is never used (staticcheck)
        deployment, err := clientSet.AppsV1().Deployments(uniqueNamespace).Get(ctx, deploymentName, metav1.GetOptions{})
        ^
integration-tests/manifests/cmd/validate_instrumentation_vars.go:10:2: SA1019: "io/ioutil" has been deprecated since Go 1.19: 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"
        ^
make: *** [lint] Error 1

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@dricross dricross force-pushed the dricross/add-linter branch 2 times, most recently from c451328 to 89673ca Compare December 3, 2024 18:55
@dricross dricross force-pushed the dricross/add-linter branch from 69411af to 415f3e7 Compare December 3, 2024 20:01
@dricross dricross merged commit a8ef913 into main Dec 3, 2024
9 checks passed
@dricross dricross deleted the dricross/add-linter branch December 3, 2024 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants