Skip to content

Commit 1708da4

Browse files
authored
Fix: add linters to the CI tasks (#23)
* fix: add linters * fix: os process find and kill properly * fix: correct condition
1 parent 2d375f3 commit 1708da4

File tree

6 files changed

+37
-74
lines changed

6 files changed

+37
-74
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
5757
- name: Run linters
5858
run: |
59-
echo 'eirctl run vuln:check'
59+
eirctl run lints
6060
6161
- name: Unit Tests
6262
run: |

.golangci.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: "2"
2+
linters:
3+
# Default set of linters.
4+
# The value can be: `standard`, `all`, `none`, or `fast`.
5+
# Default: standard
6+
default: standard
7+
exclusions:
8+
generated: lax
9+
# Log a warning if an exclusion rule is unused.
10+
# Default: false
11+
warn-unused: true
12+
# Predefined exclusion rules.
13+
# Default: []
14+
presets:
15+
- comments
16+
- std-error-handling
17+
- common-false-positives
18+
- legacy
19+
# Excluding configuration per-path, per-linter, per-text and per-source.
20+
rules:
21+
# Exclude some linters from running on tests files.
22+
- path: _test\.go
23+
linters:
24+
- gocyclo
25+
- errcheck
26+
- dupl
27+
- gosec
28+
- ineffassign
29+
- staticcheck
30+
- unused
31+
- govet

Makefile

Lines changed: 0 additions & 69 deletions
This file was deleted.

cmd/saml.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func newSamlCmd(r *Root) {
6767
return err
6868
}
6969

70-
allRoles := credentialexchange.MergeRoleChain(flags.role, r.rootFlags.roleChain, sc.flags.isSso)
70+
allRoles := credentialexchange.MergeRoleChain(flags.role, r.rootFlags.roleChain, flags.isSso)
7171
conf := credentialexchange.CredentialConfig{
7272
ProviderUrl: flags.providerUrl,
7373
PrincipalArn: flags.principalArn,

eirctl.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ tasks:
7474
- |
7575
mkdir -p .deps
7676
ldflags="-s -w -X \"github.com/{{.RepoOwner}}/{{.BinName}}/cmd.Version={{.Version}}\" -X \"github.com/{{.RepoOwner}}/{{.BinName}}/cmd.Revision={{.Revision}}\" -extldflags -static"
77-
CGO_ENABLED=0 GOPATH=$PWD/.deps GOOS=${BUILD_GOOS} GOARCH=${BUILD_GOARCH} go build -mod=readonly -buildvcs=false -ldflags="$ldflags" -o dist/{{.BinName}}-${BUILD_GOOS}${BUILD_GOARCH} .
77+
CGO_ENABLED=0 GOPATH=$PWD/.deps GOOS=${BUILD_GOOS} GOARCH=${BUILD_GOARCH} go build -mod=readonly -buildvcs=false -ldflags="$ldflags" -o dist/{{.BinName}}-${BUILD_GOOS}-${BUILD_GOARCH} .
7878
variations:
7979
- BUILD_GOOS: windows
8080
BUILD_GOARCH: amd64

internal/web/web.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ func (web *Web) MustClose() {
227227
utils.Sleep(0.5)
228228
// remove process just in case
229229
// os.Process is cross platform safe way to remove a process
230-
osprocess := os.Process{Pid: web.launcher.PID()}
231-
_ = osprocess.Kill()
230+
if osprocess, err := os.FindProcess(web.launcher.PID()); err == nil && osprocess != nil {
231+
_ = osprocess.Kill()
232+
}
232233
}

0 commit comments

Comments
 (0)