Skip to content
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

Convert to go modules, update dependencies, fix integration tests and linter errors #596

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

teutat3s
Copy link
Member

@teutat3s teutat3s commented Nov 9, 2022

Supersedes #594

This PR is a direct response to the recent comment by @danmcd in #594.

This is my first attempt at trying to split that big PR into multiple smaller ones, hopefully getting them merged.

Feedback welcome.

Testing notes:

  • ran the following command successfully:
make clean build lint test integration

EDIT:
Once this gets merged, I'll open follow-up PRs that work on top of this.

gbmeuk and others added 16 commits November 8, 2022 14:30
tests are failing because ps is missing from the node base Docker image

fix telemetry test looking for wrong value

Update run.sh

add output to sensor.sh for testing

cat files to see what is being tested

-putmetric in test_telemetry run.sh...

because sensor.sh isn't working

change metric name in -putmetric test

put grep back into test_telemetry/run.sh
More integration test fixes

Bump go version 1.14

Bump consul version to 1.7.3

Fix coprocess integration test

Fix integration tests with drone CI
len() for []interface{} is defined as zero

https://staticcheck.io/docs/checks#S1009

lint: staticcheck S1034 assigning the result of

this type assertion to a variable (switch intv :=
intv.(type)) could eliminate type assertions in
switch cases

lint: staticcheck S1023 redundant return / break

statement

https://staticcheck.io/docs/checks#S1023

lint: staticcheck S1039 unnecessary use of

fmt.Sprintf

https://staticcheck.io/docs/checks#S1039

lint: staticcheck unnecessary guard around call to

delete

https://staticcheck.io/docs/checks#S1033

lint: go vet, literal copies lock value from

*client: github.com/hashicorp/consul/api.Client contains sync.RWMutex

lint: staticcheck S1025 should use String()

instead of fmt.Sprintf

https://staticcheck.io/docs/checks#S1025

lint: go vet, events.Event composite literal uses unkeyed fields

lint: golint is deprecated, replace with staticcheck

lint: staticcheck U1000 field / func is unused

lint: staticcheck ST1005 error strings should not

be capitalized

https://staticcheck.io/docs/checks#ST1005

lint: staticcheck SA1012 do not pass a nil Context

even if a function permits it; pass context.TODO if

you are unsure about which Context to use

https://staticcheck.io/docs/checks#SA1012

lint: staticcheck SA4006 this value of ip is never

used

https://staticcheck.io/docs/checks#SA4006
Use go version 1.19 as base image

Bump consul version to 1.13.3

Update go.mod dependencies
Multiple: "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.  (SA1019)

discovery/consul_test.go:163:11: unnecessary use of fmt.Sprintf (S1039)
Bump consul version to 1.13.3

Use alpine:3.16 as base image

Bump consul-template to version 0.29.5

Check for go version 1.19

Cleanup CI script

Bump compose version to 2.4

Use alpine:3.16 as base image
This is no longer needed, since we use go modules now
avoid downloading multiple times

Default GOPATH in golang images is /go
@@ -14,7 +14,8 @@ import (
// requests out to a ContainerPilot process's control socket.
type HTTPClient struct {
http.Client
socketPath string
// staticcheck U1000 field is unused
//socketPath string

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If socketPath is unused I think it can just be removed.

@@ -33,7 +33,8 @@ type Job struct {
statusLock *sync.RWMutex
Service *discovery.ServiceDefinition
healthCheckExec *commands.Command
healthCheckName string
// staticcheck U1000 field is unused
//healthCheckName string

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If healthCheckName is unused I think it can just be removed.

}
//
// staticcheck U1000 func unused
//func assert(ok bool, msg string) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this assert is unused I think it can just be removed.

@travispaul
Copy link

Hi @teutat3s, thanks for your work on this. I had a couple of small comments but nothing crazy.

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.

None yet

3 participants