Skip to content

Fix some basic tech debt #3

Merged
invidian merged 56 commits intomainfrom
invidian/base-fixes
Nov 2, 2021
Merged

Fix some basic tech debt #3
invidian merged 56 commits intomainfrom
invidian/base-fixes

Conversation

@invidian
Copy link
Copy Markdown
Member

No description provided.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Add basic configuration which currently does not report any issues, so
we can gradually re-enable remaining linters.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
As it only runs unit tests right now.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Running golangci-lint.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
To re-enable errorlint linter.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Also so we don't have a mix of exported struct fields and capitalized
variable names.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
@tormath1
Copy link
Copy Markdown
Collaborator

Good - thanks for this, I used goimports which basically runs a go fmt before committing files. Funny that it did not catch

var (
    toto = "toto"
)

to:

var toto = "toto"

To avoid capitalized local variables and to enable gocritic linter.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Now that all issues reported by it has been resolved.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
To enable paralleltest linter.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
As it reports no issues anymore.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
So all comments ends with dots.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
To be able to re-enable wsl linter.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Now that it does not report any issues.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
This is the formatting used in
https://coreos.github.io/zincati/development/fleetlock/protocol/
so I think this is the correct one which should be used when possible.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
So stylecheck linter does not complain.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
So stylecheck linter does not complain.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
As all reported issues has been fixed.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
As it does not find any more typos.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
So lll linter can be enabled.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
It does not report any issues anymore.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
So nlreturn linter does not complain.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
It does not report any issues anymore.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Otherwise revive linter complains with the following message:

exported: type name will be used as client.ClientParams by other
packages, and that stutters; consider calling this Params

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Even though it shouldn't really be exported as it makes it globally
writable, but this fixes revive linter.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
As it does not report any more issues.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
As it is required by FleetLock protocol but it is not a standard case
for JSON format, so tagliatelle linter complains.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
It does not report any issues anymore.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
So errcheck linter can be enabled.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
So errcheck linter can have extra checks enabled.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Now that it does not report any more issues.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
So they can be cancelled when take too much time.

For now fleetlockcli has no timeout defined by default.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
It does not report any issues anymore.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Replace it with more convinient ranges to satisfy gomnd linter.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
It does not report any more issues.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
So it matches auto-generated one.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Copy link
Copy Markdown
Collaborator

@tormath1 tormath1 left a comment

Choose a reason for hiding this comment

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

This is great, some love to FleetLock :D Some comment, otherwise we're good to merge this. :)

@invidian
Copy link
Copy Markdown
Member Author

invidian commented Nov 2, 2021

Selection_489
image

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
So new linters are either explicitly enabled or disabled while updating
the linter.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
As with targets without associated source files it is usually not
desired to run things in parallel.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
So each target has some helpful description.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
To catch more potential typos.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
As if one looks at the source code, exported functions take precedence
in importance than unexported functions.

Also the order is that the New() is first, then the client methods, as
usually you need New() first to do other things.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
cobra already takes care of printing the execution error to stderr.

This also prevents printing the error message without newline at the
end.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
So when help is invoked, every available subcommand has some
description.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
@invidian invidian force-pushed the invidian/base-fixes branch from 56f44f5 to 0e1c5d3 Compare November 2, 2021 09:32
@invidian invidian requested a review from tormath1 November 2, 2021 09:33
Copy link
Copy Markdown
Collaborator

@tormath1 tormath1 left a comment

Choose a reason for hiding this comment

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

One last comment, let's merge it then :)
Thanks for this :D

@invidian invidian merged commit 8937d30 into main Nov 2, 2021
@invidian invidian deleted the invidian/base-fixes branch November 2, 2021 10:26
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.

2 participants