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

.golangci.yml: update rules #514

Merged
merged 3 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ linters:
- whitespace
- depguard
- containedctx
- fatcontext
- mirror
- loggercheck
linters-settings:
exhaustive:
default-signifies-exhaustive: true
Expand All @@ -31,8 +34,21 @@ linters-settings:
# - G304
# - G404
govet:
# report about shadowed variables
check-shadowing: true
enable:
- shadow
settings:
printf:
# Additionally check custom logger
funcs:
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Debugf
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Infof
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Warnf
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Errorf
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Panicf
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Fatalf
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).AssumptionViolationf
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).Tracef
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).Criticalf
errorlint:
# Allow formatting of errors without %w
errorf: false
Expand Down Expand Up @@ -111,6 +127,21 @@ linters-settings:
desc: Use gopkg.in/guregu/null.v4 instead
- pkg: "gopkg.in/guregu/null.v3"
desc: Use gopkg.in/guregu/null.v4 instead
- pkg: github.com/go-gorm/gorm
desc: Use github.com/jmoiron/sqlx directly instead
loggercheck:
# Check that *w logging functions have even number of args (i.e., well formed key-value pairs).
rules:
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Debugw
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Infow
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Warnw
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Errorw
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Panicw
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Fatalw
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).AssumptionViolationw
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).Tracew
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).Criticalw
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).With
issues:
exclude-rules:
- path: test
Expand Down
58 changes: 12 additions & 46 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

106 changes: 55 additions & 51 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,58 +1,62 @@
{ stdenv, pkgs, lib, scriptDir }:

with pkgs;
let
{
stdenv,
pkgs,
lib,
scriptDir,
}:
with pkgs; let
go = pkgs.go_1_21;

mkShell' = mkShell.override {
# juno requires building with clang, not gcc
stdenv = pkgs.clangStdenv;
};
in
mkShell' {
nativeBuildInputs = [
stdenv.cc.cc.lib
(rust-bin.stable.latest.default.override { extensions = [ "rust-src" ]; })
nodejs-18_x
(yarn.override { nodejs = nodejs-18_x; })
nodePackages.typescript
nodePackages.typescript-language-server
nodePackages.npm
python3

python311Packages.ledgerwallet
go

gopls
delve
(golangci-lint.override { buildGoModule = buildGo121Module; })
gotools

kubectl
kubernetes-helm

postgresql_15 # psql

] ++ lib.optionals stdenv.isLinux [
# ledger specific packages
libudev-zero
libusb1
];

LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.zlib stdenv.cc.cc.lib ]; # lib64

GOROOT = "${go}/share/go";
CGO_ENABLED = 0;
HELM_REPOSITORY_CONFIG = "${scriptDir}/.helm-repositories.yaml";

shellHook = ''
# Update helm repositories
helm repo update > /dev/null
# setup go bin for nix
export GOBIN=$HOME/.nix-go/bin
mkdir -p $GOBIN
export PATH=$GOBIN:$PATH
# install gotestloghelper
go install github.com/smartcontractkit/chainlink-testing-framework/tools/gotestloghelper@latest
'';
}
mkShell' {
nativeBuildInputs =
[
stdenv.cc.cc.lib
(rust-bin.stable.latest.default.override {extensions = ["rust-src"];})
nodejs-18_x
(yarn.override {nodejs = nodejs-18_x;})
nodePackages.typescript
nodePackages.typescript-language-server
nodePackages.npm
python3

python311Packages.ledgerwallet
go

gopls
delve
(golangci-lint.override {buildGoModule = buildGo122Module;})
gotools
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is the only change, the rest is the formatter


kubectl
kubernetes-helm

postgresql_15 # psql
]
++ lib.optionals stdenv.isLinux [
# ledger specific packages
libudev-zero
libusb1
];

LD_LIBRARY_PATH = lib.makeLibraryPath [pkgs.zlib stdenv.cc.cc.lib]; # lib64

GOROOT = "${go}/share/go";
CGO_ENABLED = 0;
HELM_REPOSITORY_CONFIG = "${scriptDir}/.helm-repositories.yaml";

shellHook = ''
# Update helm repositories
helm repo update > /dev/null
# setup go bin for nix
export GOBIN=$HOME/.nix-go/bin
mkdir -p $GOBIN
export PATH=$GOBIN:$PATH
# install gotestloghelper
go install github.com/smartcontractkit/chainlink-testing-framework/tools/gotestloghelper@latest
'';
}
Loading