File tree 5 files changed +57
-16
lines changed
5 files changed +57
-16
lines changed Original file line number Diff line number Diff line change @@ -122,19 +122,18 @@ jobs:
122
122
# loki_password: ${{ secrets.LOKI_PASSWORD || '' }}
123
123
Lint :
124
124
runs-on : ubuntu-latest
125
+ defaults :
126
+ run :
127
+ shell : nix develop --command bash -x {0}
125
128
steps :
126
129
- uses : actions/checkout@v4
127
- - uses : ./.github/actions/setup-go-for-project
130
+ - uses : ./.github/actions/install-nix
128
131
- name : Run static analysis tests
129
- shell : bash
130
132
run : scripts/lint.sh
131
133
- name : Run actionlint
132
- shell : bash
133
- run : scripts/actionlint.sh
134
- - uses : ./.github/actions/install-nix
134
+ run : actionlint
135
135
- name : Run shellcheck
136
- shell : bash
137
- run : nix develop --command bash -x scripts/shellcheck.sh
136
+ run : scripts/shellcheck.sh
138
137
buf-lint :
139
138
name : Protobuf Lint
140
139
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 8
8
9
9
# Flake inputs
10
10
inputs = {
11
- nixpkgs . url = "https://flakehub.com/f/NixOS/nixpkgs/0.2405 .*.tar.gz" ;
11
+ nixpkgs . url = "https://flakehub.com/f/NixOS/nixpkgs/0.2411 .*.tar.gz" ;
12
12
} ;
13
13
14
14
# Flake outputs
47
47
self . packages . ${ system } . kind-with-registry # Script installing kind configured with a local registry
48
48
49
49
# Linters
50
+ ( import ./nix/golangci-lint.nix { inherit pkgs ; } )
51
+ actionlint
50
52
shellcheck
51
53
] ++ lib . optionals stdenv . isDarwin [
52
54
# macOS-specific frameworks
Original file line number Diff line number Diff line change
1
+ { pkgs } :
2
+ let
3
+ # Helper functions to derive Go arch from Nix arch
4
+ nixArchToGoArch = arch : {
5
+ "x86_64" = "amd64" ;
6
+ "aarch64" = "arm64" ;
7
+ } . ${ arch } or arch ;
8
+
9
+ # Split system into arch and os
10
+ parseSystem = system :
11
+ let
12
+ parts = builtins . split "-" system ;
13
+ arch = builtins . elemAt parts 0 ;
14
+ os = builtins . elemAt parts 2 ;
15
+ in {
16
+ osArch = "${ os } -${ nixArchToGoArch arch } " ;
17
+ } ;
18
+
19
+
20
+ # Update the following to change the version:
21
+
22
+ # 1.63.4 is the only binary release compatible with go1.23.
23
+ # Newer versions are built with go1.24.x and consume memory until OOMkilled.
24
+ lintVersion = "1.63.4" ;
25
+ lintSHA256s = {
26
+ "linux-amd64" = "01abb14a4df47b5ca585eff3c34b105023cba92ec34ff17212dbb83855581690" ;
27
+ "linux-arm64" = "51f0c79d19a92353e0465fb30a4901a0644a975d34e6f399ad2eebc0160bbb24" ;
28
+ "darwin-amd64" = "878d017cc360e4fb19510d39852c8189852e3c48e7ce0337577df73507c97d68" ;
29
+ "darwin-arm64" = "a2b630c2ac8466393f0ccbbede4462387b6c190697a70bc2298c6d2123f21bbf" ;
30
+ } ;
31
+
32
+ targetSystem = parseSystem pkgs . system ;
33
+ in
34
+ pkgs . stdenv . mkDerivation {
35
+ name = "golangci-lint-${ lintVersion } " ;
36
+ version = lintVersion ;
37
+
38
+ src = pkgs . fetchurl {
39
+ url = "https://github.com/golangci/golangci-lint/releases/download/v${ lintVersion } /golangci-lint-${ lintVersion } -${ targetSystem . osArch } .tar.gz" ;
40
+ sha256 = lintSHA256s . ${ targetSystem . osArch } or ( throw "Unsupported system: ${ pkgs . system } " ) ;
41
+ } ;
42
+
43
+ installPhase = ''
44
+ mkdir -p $out/bin
45
+ cp -r ./golangci-lint $out/bin
46
+ '' ;
47
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 32
32
TESTS=${TESTS:- " golangci_lint license_header require_error_is_no_funcs_as_params single_import interface_compliance_nil require_no_error_inline_func import_testing_only_in_tests" }
33
33
34
34
function test_golangci_lint {
35
- go install -v github.com/golangci/golangci-lint/cmd/
[email protected]
36
35
golangci-lint run --config .golangci.yml
37
36
}
38
37
@@ -41,6 +40,7 @@ function test_golangci_lint {
41
40
# TESTS='license_header' ADDLICENSE_FLAGS="--debug" ./scripts/lint.sh
42
41
_addlicense_flags=${ADDLICENSE_FLAGS:- " --verify --debug" }
43
42
function test_license_header {
43
+ # TODO(marun) Migrate to a nix package
44
44
go install -v github.com/palantir/
[email protected]
45
45
local files=()
46
46
while IFS= read -r line; do files+=(" $line " ); done < <( find . -type f -name ' *.go' ! -name ' *.pb.go' ! -name ' mock_*.go' ! -name ' mocks_*.go' ! -path ' ./**/*mock/*.go' ! -name ' *.canoto.go' )
You can’t perform that action at this time.
0 commit comments