Skip to content

Commit 489fc1e

Browse files
authored
Upgrade (#32)
* update mod and deps * update ci * fix linting * remove line from golangci config * upgrade exex
1 parent 9913d43 commit 489fc1e

File tree

7 files changed

+126
-37
lines changed

7 files changed

+126
-37
lines changed

.github/workflows/test_ci.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ jobs:
1818
- name: Run golangci-lint
1919
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3
2020
with:
21-
# Hard-coding version due to this bug: https://github.com/golangci/golangci-lint-action/issues/535
22-
version: v1.52.2
21+
version: v1.55.2
2322
test:
2423
name: go test
2524
runs-on: ubuntu-latest
@@ -29,15 +28,15 @@ jobs:
2928
- name: Checkout
3029
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
3130
- name: Set up Go
32-
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4
31+
uses: actions/setup-go@v5
3332
with:
34-
go-version: 1.18
33+
go-version: 1.21.6
3534
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4
3635
with:
3736
python-version: 'pypy3.9'
3837
- name: Set up gotestfmt
3938
uses: GoTestTools/gotestfmt-action@v2
40-
- uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
39+
- uses: actions/cache@v4
4140
with:
4241
path: |
4342
~/go/pkg/mod
@@ -60,7 +59,7 @@ jobs:
6059
go tool cover -func /tmp/coverage.out
6160
echo "::endgroup::"
6261
- name: Upload test log
63-
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
62+
uses: actions/upload-artifact@v4
6463
if: always()
6564
with:
6665
name: test-results

.golangci.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
run:
2+
timeout: 5m
3+
linters:
4+
enable:
5+
# region General
6+
7+
# Add depguard to prevent adding additional dependencies. This is a client library, we really don't want
8+
# additional dependencies.
9+
- depguard
10+
# Prevent improper directives in go.mod.
11+
- gomoddirectives
12+
# Prevent improper nolint directives.
13+
- nolintlint
14+
15+
# endregion
16+
17+
18+
# region Code Quality and Comments
19+
20+
# Inspect source code for potential security problems. This check has a fairly high false positive rate,
21+
# comment with // nolint:gosec where not relevant.
22+
- gosec
23+
# Replace golint.
24+
# - revive
25+
# Complain about deeply nested if cases.
26+
- nestif
27+
# Prevent naked returns in long functions.
28+
- nakedret
29+
# Make Go code more readable.
30+
# - gocritic
31+
# Check if comments end in a period. This helps prevent incomplete comment lines, such as half-written sentences.
32+
# - godot
33+
# Complain about comments as these indicate incomplete code.
34+
- godox
35+
# Keep the cyclomatic complexity of functions to a reasonable level.
36+
- gocyclo
37+
# Complain about cognitive complexity of functions.
38+
- gocognit
39+
# Find repeated strings that could be converted into constants.
40+
# - goconst
41+
# Complain about unnecessary type conversions.
42+
- unconvert
43+
# Complain about unused parameters. These should be replaced with underscores.
44+
- unparam
45+
# Check for non-ASCII identifiers.
46+
- asciicheck
47+
# Check for HTTP response body being closed. Sometimes, you may need to disable this using // nolint:bodyclose.
48+
- bodyclose
49+
# Check for duplicate code. You may want to disable this with // nolint:dupl if the source code is the same, but
50+
# legitimately exists for different reasons.
51+
- dupl
52+
# Check for pointers in loops. This is a typical bug source.
53+
- exportloopref
54+
# Prevent dogsledding (mass-ignoring return values). This typically indicates missing error handling.
55+
- dogsled
56+
# Enforce consistent import aliases across all files.
57+
- importas
58+
# Make code properly formatted.
59+
- gofmt
60+
# Prevent faulty error checks.
61+
- nilerr
62+
# Prevent direct error checks that won't work with wrapped errors.
63+
- errorlint
64+
# Find slice usage that could potentially be preallocated.
65+
- prealloc
66+
# Check for improper duration handling.
67+
- durationcheck
68+
# Enforce tests being in the _test package.
69+
# - testpackage
70+
71+
# endregion
72+
linters-settings:
73+
depguard:
74+
rules:
75+
main:
76+
list-mode: strict
77+
allow:
78+
- $gostd
79+
- go.flow.arcalot.io/
80+
- go.arcalot.io/
81+
- github.com/docker/
82+
- github.com/opencontainers/
83+
- gopkg.in/yaml.v3
84+
- github.com/fxamacker/cbor
85+
- golang.org/
86+
govet:
87+
enable-all: true
88+
check-shadowing: false
89+
disable:
90+
# We don't care about variable shadowing.
91+
- shadow
92+
- fieldalignment
93+
stylecheck:
94+
checks:
95+
- all
96+
issues:
97+
exclude-use-default: false

go.mod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module go.flow.arcalot.io/pythondeployer
22

3-
go 1.18
3+
go 1.21
44

55
require (
6-
go.arcalot.io/assert v1.6.1
7-
go.arcalot.io/lang v1.0.0
6+
go.arcalot.io/assert v1.7.0
7+
go.arcalot.io/lang v1.1.0
88
)
99

1010
require (
@@ -13,8 +13,8 @@ require (
1313
)
1414

1515
require (
16-
go.arcalot.io/exex v0.1.0
17-
go.arcalot.io/log/v2 v2.0.0
18-
go.flow.arcalot.io/deployer v0.4.0
19-
go.flow.arcalot.io/pluginsdk v0.5.1
16+
go.arcalot.io/exex v0.2.0
17+
go.arcalot.io/log/v2 v2.1.0
18+
go.flow.arcalot.io/deployer v0.5.0
19+
go.flow.arcalot.io/pluginsdk v0.8.0
2020
)

go.sum

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ github.com/fxamacker/cbor/v2 v2.5.0 h1:oHsG0V/Q6E/wqTS2O1Cozzsy69nqCiguo5Q1a1ADi
22
github.com/fxamacker/cbor/v2 v2.5.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo=
33
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
44
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
5-
go.arcalot.io/assert v1.6.1 h1:pr7wvTE/vZJ4pY0f88R8tXicTOGogkGS1mtY0Qb7GRE=
6-
go.arcalot.io/assert v1.6.1/go.mod h1:Xy3ScX0p9IMY89gdsgexOKxnmDr0nGHG9dV7p8Uxg7w=
7-
go.arcalot.io/exex v0.1.0 h1:0SSaU7NO73Tdx6N1G4cPzbJvE+e+XpkH5G4DOJYBiyo=
8-
go.arcalot.io/exex v0.1.0/go.mod h1:ohSmm9Y/648LeThX2tY8Lg0YMYYQrlmqzIC3C4lxPxA=
9-
go.arcalot.io/lang v1.0.0 h1:mgDaieT4wWdZTnR4V7+/pgYRmzfU7VZZgIzHccuxAbY=
10-
go.arcalot.io/lang v1.0.0/go.mod h1:ALqfYEhAzC2WoGLaycmJoNJd5NmkR7V1PSKp/c5D278=
11-
go.arcalot.io/log/v2 v2.0.0 h1:mbmsWDVBXZNWrDzUh5JLzeGCQ59kTuMFs+pyfJGc1hk=
12-
go.arcalot.io/log/v2 v2.0.0/go.mod h1:1V8jnFIIGwh2CtcGkHNOmy1nCo7LbazQNkUcnKYNMn4=
13-
go.flow.arcalot.io/deployer v0.4.0 h1:5YveLCX+zc8Ra/aukHOwD5OrJD2W8WRzoruf3bpJfqY=
14-
go.flow.arcalot.io/deployer v0.4.0/go.mod h1:x6gsz/hANR8qN1nerpyY3vXpdaqofDH5Wlg+Nsqg/x0=
15-
go.flow.arcalot.io/pluginsdk v0.5.1 h1:ebb2ThAqmjmwGpDyKpd1wEDUisPqPabgARjFohy47Io=
16-
go.flow.arcalot.io/pluginsdk v0.5.1/go.mod h1:2s2f//7uOkBjr1QaiWJD/bqDIeLlINJtD1BhiY4aGPM=
5+
go.arcalot.io/assert v1.7.0 h1:PTLyeisNMUKpM9wXRDxResanBhuGOYO1xFK3v5b3FSw=
6+
go.arcalot.io/assert v1.7.0/go.mod h1:nNmWPoNUHFyrPkNrD2aASm5yPuAfiWdB/4X7Lw3ykHk=
7+
go.arcalot.io/exex v0.2.0 h1:u44pjwPwcH57TF8knhaqVZP/1V/KbnRe//pKzMwDpLw=
8+
go.arcalot.io/exex v0.2.0/go.mod h1:5zlFr+7vOQNZKYCNOEDdsad+z/dlvXKs2v4kG+v+bQo=
9+
go.arcalot.io/lang v1.1.0 h1:ugglRKpd3qIMkdghAjKJxsziIgHm8QpxrzZPSXoa08I=
10+
go.arcalot.io/lang v1.1.0/go.mod h1:2BZJO4csY7NnN/Nf1+eTdIQH4A2vxtOMneaO+PJl+Co=
11+
go.arcalot.io/log/v2 v2.1.0 h1:lNO931hJ82LgS6WcCFCxpLWXQXPFhOkz6PyAJ/augq4=
12+
go.arcalot.io/log/v2 v2.1.0/go.mod h1:PNWOSkkPmgS2OMlWTIlB/WqOw0yaBvDYd8ENAP80H4k=
13+
go.flow.arcalot.io/deployer v0.5.0 h1:yXYogvL3shNBEEoTx9U9CNbfxuf8777uAH5Vn3hv1Yo=
14+
go.flow.arcalot.io/deployer v0.5.0/go.mod h1:whj8wOUursCnfZCt1a7eY5hU3EyOcUG48vM4NeAe5N8=
15+
go.flow.arcalot.io/pluginsdk v0.8.0 h1:cShsshrR17ZFLcbgi3aZvqexLttcp3JISFNqPUPuDvA=
16+
go.flow.arcalot.io/pluginsdk v0.8.0/go.mod h1:sk7ssInR/T+Gy+RSRr+QhKqZcECFFxMyn1hPQCTZSyU=
1717
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
18+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

internal/cliwrapper/cliwrapper_test.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func GetPythonPath() (string, error) {
2727
return p, nil
2828
}
2929
return "", fmt.Errorf("errors getting paths for Python3 (%s) and python (%s)",
30-
errP3.Error(), errP.Error())
30+
errP3.Error(), errP.Error()) //nolint:govet // errP3 and errP will not be nil if this line is reached
3131
}
3232

3333
// Test the function PullModule immediately returns an error on
@@ -36,10 +36,6 @@ func GetPythonPath() (string, error) {
3636
func Test_PullModule_NonexistentGitLocation(t *testing.T) {
3737
testModule := TestModule{
3838
Location: "nonexistent@git+https://github.com/arcalot/nonexistent.git",
39-
StepID: "wait",
40-
Input: map[string]any{
41-
"seconds": 0.1,
42-
},
4339
}
4440

4541
tempdir := "/tmp/pullmodule1"
@@ -69,10 +65,6 @@ func Test_PullModule_NonexistentGitLocation(t *testing.T) {
6965
func Test_PullModule_ErrorModuleNameFmt(t *testing.T) {
7066
testModule := TestModule{
7167
Location: "git+https://github.com/arcalot/arcaflow-plugin-wait.git@afdc2323805ffe2b37271f3a852a4ce7ac7379e1",
72-
StepID: "wait",
73-
Input: map[string]any{
74-
"seconds": 0.1,
75-
},
7668
}
7769

7870
tempdir := "/tmp/pullmodule2"

internal/connector/cli_plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (p *CliPlugin) KillAndClean() error {
6363

6464
slurp, err := io.ReadAll(p.stderr)
6565
if err != nil {
66-
return nil
66+
return err
6767
}
6868
p.logger.Debugf("python plugin module stderr: %s", slurp)
6969
return nil

internal/connector/connector_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func GetPythonPath() (string, error) {
3030
return p, nil
3131
}
3232
return "", fmt.Errorf("errors getting paths for Python3 (%s) and python (%s)",
33-
errP3.Error(), errP.Error())
33+
errP3.Error(), errP.Error()) //nolint:govet // errP3 and errP will not be nil if this line is reached
3434
}
3535

3636
const examplePluginNickname string = "pythonuser"
@@ -202,7 +202,7 @@ func RandString(n int) string {
202202
var chars = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
203203
b := make([]rune, n)
204204
for i := range b {
205-
b[i] = chars[rand.Intn(len(chars))]
205+
b[i] = chars[rand.Intn(len(chars))] //nolint:gosec // not for a security credential
206206
}
207207
return string(b)
208208
}

0 commit comments

Comments
 (0)