Skip to content

Commit 724cb68

Browse files
committed
fix all golangci-lint warnings
1 parent d060ccf commit 724cb68

56 files changed

Lines changed: 725 additions & 964 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-test-models.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ jobs:
2828
- name: Set up Go
2929
uses: actions/setup-go@v2
3030
with:
31-
go-version: '1.25.4'
31+
go-version: '1.25.5'
3232
- name: Checkout code
3333
uses: actions/checkout@v4
3434
- name: Install dependencies
3535
run: |
3636
go mod download
3737
- name: download models
3838
run: |
39-
go run testData/downloadModels.go
39+
go run testcases/downloadModels.go
4040
- name: List models directory
4141
run: ls -l ./models
4242
- name: Remove models from .dockerignore # make sure models folder is not ignored

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Set up Go
2727
uses: actions/setup-go@v2
2828
with:
29-
go-version: '1.25.4'
29+
go-version: '1.25.5'
3030
- name: Checkout code
3131
uses: actions/checkout@v4
3232
- name: Install dependencies

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up Go
1717
uses: actions/setup-go@v2
1818
with:
19-
go-version: '1.25.4'
19+
go-version: '1.25.5'
2020
- name: Checkout code
2121
uses: actions/checkout@v4
2222
- name: Install dependencies

.golangci.yml

Lines changed: 26 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,62 @@
1+
version: "2"
12
linters:
3+
default: none
24
enable:
3-
# Check for pass []any as any in variadic func(...any).
4-
# Rare case but saved me from debugging a few times.
55
- asasalint
6-
7-
# I prefer plane ASCII identifiers.
8-
# Symbol `∆` instead of `delta` looks cool but no thanks.
96
- asciicheck
10-
11-
# Checks for dangerous unicode character sequences.
12-
# Super rare but why not to be a bit paranoid?
137
- bidichk
14-
15-
# Checks whether HTTP response body is closed successfully.
168
- bodyclose
17-
18-
# Check whether the function uses a non-inherited context.
199
- contextcheck
20-
21-
# Check for two durations multiplied together.
2210
- durationcheck
23-
24-
# Forces to not skip error check.
2511
- errcheck
26-
27-
# Checks `Err-` prefix for var and `-Error` suffix for error type.
2812
- errname
29-
30-
# Suggests to use `%w` for error-wrapping.
3113
- errorlint
32-
33-
# Checks for pointers to enclosing loop variables.
34-
- exportloopref
35-
36-
# Forces to put `.` at the end of the comment. Code is poetry.
3714
- godot
38-
39-
# Might not be that important but I prefer to keep all of them.
40-
# `gofumpt` is amazing, kudos to Daniel Marti https://github.com/mvdan/gofumpt
41-
- gofmt
42-
- gofumpt
43-
- goimports
44-
45-
# Allow or ban replace directives in go.mod
46-
# or force explanation for retract directives.
47-
- gomoddirectives
48-
49-
# Powerful security-oriented linter. But requires some time to
50-
# configure it properly, see https://github.com/securego/gosec#available-rules
5115
- gosec
52-
53-
# Linter that specializes in simplifying code.
54-
- gosimple
55-
56-
# Official Go tool. Must have.
5716
- govet
58-
59-
# Detects when assignments to existing variables are not used
60-
# Last week I caught a bug with it.
6117
- ineffassign
62-
63-
# Fix all the misspells, amazing thing.
6418
- misspell
65-
66-
# Finds naked/bare returns and requires change them.
6719
- nakedret
68-
69-
# Both require a bit more explicit returns.
7020
- nilerr
7121
- nilnil
72-
73-
# Finds sending HTTP request without context.Context.
7422
- noctx
75-
76-
# Forces comment why another check is disabled.
77-
# Better not to have //nolint: at all ;)
7823
- nolintlint
79-
80-
# Finds slices that could potentially be pre-allocated.
81-
# Small performance win + cleaner code.
82-
- prealloc
83-
84-
# Finds shadowing of Go's predeclared identifiers.
85-
# I hear a lot of complaints from junior developers.
86-
# But after some time they find it very useful.
8724
- predeclared
88-
89-
# Lint your Prometheus metrics name.
9025
- promlinter
91-
92-
# Checks that package variables are not reassigned.
93-
# Super rare case but can catch bad things (like `io.EOF = nil`)
9426
- reassign
95-
96-
# Drop-in replacement of `golint`.
9727
- revive
98-
99-
# Somewhat similar to `bodyclose` but for `database/sql` package.
10028
- rowserrcheck
10129
- sqlclosecheck
102-
103-
# I have found that it's not the same as staticcheck binary :\
10430
- staticcheck
105-
106-
# Is a replacement for `golint`, similar to `revive`.
107-
- stylecheck
108-
109-
# Check struct tags.
110-
- tagliatelle
111-
112-
# Test-related checks. All of them are good.
113-
- tenv
11431
- testableexamples
11532
- thelper
11633
- tparallel
117-
118-
# Remove unnecessary type conversions, make code cleaner
11934
- unconvert
120-
121-
# Might be noisy but better to know what is unused
12235
- unparam
123-
124-
# Must have. Finds unused declarations.
12536
- unused
126-
127-
# Detect the possibility to use variables/constants from stdlib.
12837
- usestdlibvars
129-
130-
# Finds wasted assignment statements.
13138
- wastedassign
132-
133-
version: "2"
39+
exclusions:
40+
generated: lax
41+
presets:
42+
- comments
43+
- common-false-positives
44+
- legacy
45+
- std-error-handling
46+
settings:
47+
nolintlint:
48+
allow-unused: false
49+
allow-no-explanation: []
50+
require-explanation: true
51+
require-specific: true
52+
formatters:
53+
enable:
54+
- gofmt
55+
- gofumpt
56+
- goimports
57+
exclusions:
58+
generated: lax
59+
paths:
60+
- third_party$
61+
- builtin$
62+
- examples$

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2323
### Changed
2424

2525
- Update to new goMLX project structure (0.24.0+)
26-
- remove the depency on python when installing goMLX libraries
26+
- remove the dependency on python when installing goMLX libraries
2727

2828
## [0.5.5] - 2025-09-30
2929

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#--- dockerfile to test hugot ---
22

3-
ARG GO_VERSION=1.25.4
3+
ARG GO_VERSION=1.25.5
44
ARG ONNXRUNTIME_VERSION=1.22.0
55
ARG GOPJRT_VERSION=0.9.1
66
ARG BUILD_PLATFORM=linux/amd64

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ following models:
217217
- **Gemma Family**: `onnx-community/gemma-3-1b-it-ONNX`, `onnx-community/gemma-3-270m-it-ONNX`
218218
- **Phi Family**: `microsoft/Phi-3-mini-4k-instruct-onnx`, `microsoft/Phi-3.5-mini-instruct-onnx`
219219

220-
Generative models typically use external weights, so use the downloadOptions.ExternalDataPath option when downloading the model. See the [example](./testData/downloadModels.go ) here.
220+
Generative models typically use external weights, so use the downloadOptions.ExternalDataPath option when downloading the model. See the [example](testcases/downloadModels.go ) here.
221221

222222
### Example Usage
223223
````go
@@ -233,7 +233,7 @@ config := TextGenerationConfig{
233233
ModelPath: "./models/KnightsAnalytics_Phi-3.5-mini-instruct-onnx",
234234
Name: "testPipeline",
235235
OnnxFilename: "model.onnx",
236-
Options: []pipelineBackends.PipelineOption[*pipelines.TextGenerationPipeline]{
236+
Options: []backends.PipelineOption[*pipelines.TextGenerationPipeline]{
237237
pipelines.WithMaxTokens(200),
238238
pipelines.WithPhiTemplate(),
239239
},
@@ -316,7 +316,7 @@ We is currently supported only for the **FeatureExtractionPipeline**. This can b
316316
{"sentence1": "The quick brown fox jumps over the lazy dog", "sentence2": "A quick brown cow jumps over a lazy caterpillar", "score": 0.5}
317317
```
318318
319-
See the [example](./testData/semanticSimilarityTest.jsonl) for a sample dataset.
319+
See the [example](testcases/semanticSimilarityTest.jsonl) for a sample dataset.
320320
321321
The score is assumed to be a float between 0 and 1 that encodes the semantic similarity between the sentences, and by default a cosine similarity loss is used (see [sentence transformers](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosinesimilarityloss)). However, you can also specify a different loss function from `goMLX` using the `XLATrainingOptions` field in the `TrainingConfig` struct. See [the training tests](./hugot_training_test.go) for examples on how to train or fine-tune feature extraction pipelines.
322322
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package pipelineBackends
1+
package backends
22

33
import (
44
"fmt"

0 commit comments

Comments
 (0)