Skip to content

Commit a3345f3

Browse files
committed
explicit linter list, fixes
1 parent 35aba01 commit a3345f3

File tree

11 files changed

+47
-20
lines changed

11 files changed

+47
-20
lines changed

.github/workflows/go.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
run: |
3838
go get -v -t -d ./...
3939
40+
- name: Lint
41+
uses: golangci/golangci-lint-action@v6
42+
4043
- name: Build
4144
run: go build -v ./...
4245

.golangci.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1-
run:
2-
timeout: 3m
3-
modules-download-mode: readonly
4-
5-
issues:
6-
exclude-dirs:
7-
- sample
8-
1+
linters-settings:
2+
misspell:
3+
locale: UK
94
linters:
10-
# enable additional linters, that are disabled by default
115
enable:
126
- contextcheck
7+
- errcheck
138
- godot
149
- gofmt
1510
- goimports
11+
- gosimple
12+
- govet
13+
- ineffassign
1614
- misspell
15+
- staticcheck
16+
- unused
1717
- whitespace
18+
disable-all: true
19+
issues:
20+
max-issues-per-linter: 0
21+
max-same-issues: 0
22+
run:
23+
timeout: 5m

.pre-commit-config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ repos:
33
rev: v1.64.6
44
hooks:
55
- id: golangci-lint-full
6+
7+
ci:
8+
skip: [golangci-lint-full]

client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func NewClient(apiKey string, options ...Option) *Client {
9595
go c.pollEnvironment(c.ctxLocalEval)
9696
}
9797
}
98-
// Initialize analytics processor
98+
// Initialise analytics processor
9999
if c.config.enableAnalytics {
100100
c.analyticsProcessor = NewAnalyticsProcessor(c.ctxAnalytics, c.client, c.config.baseURL, nil, c.log)
101101
}
@@ -192,8 +192,8 @@ func (c *Client) GetIdentitySegments(identifier string, traits []*Trait) ([]*seg
192192
// BulkIdentify can be used to create/overwrite identities(with traits) in bulk
193193
// NOTE: This method only works with Edge API endpoint.
194194
func (c *Client) BulkIdentify(ctx context.Context, batch []*IdentityTraits) error {
195-
if len(batch) > bulkIdentifyMaxCount {
196-
msg := fmt.Sprintf("flagsmith: batch size must be less than %d", bulkIdentifyMaxCount)
195+
if len(batch) > BulkIdentifyMaxCount {
196+
msg := fmt.Sprintf("flagsmith: batch size must be less than %d", BulkIdentifyMaxCount)
197197
return &FlagsmithAPIError{Msg: msg}
198198
}
199199

client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"sync"
1111
"testing"
1212
"time"
13+
1314
flagsmith "github.com/Flagsmith/flagsmith-go-client/v4"
1415
"github.com/Flagsmith/flagsmith-go-client/v4/fixtures"
1516
"github.com/stretchr/testify/assert"
@@ -199,7 +200,6 @@ func TestGetFlags(t *testing.T) {
199200
assert.Equal(t, fixtures.Feature1Name, allFlags[0].FeatureName)
200201
assert.Equal(t, fixtures.Feature1ID, allFlags[0].FeatureID)
201202
assert.Equal(t, fixtures.Feature1Value, allFlags[0].Value)
202-
203203
}
204204

205205
func TestGetFlagsTransientIdentity(t *testing.T) {

config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const (
1212
// Default base URL for the API.
1313
DefaultBaseURL = "https://edge.api.flagsmith.com/api/v1/"
1414

15-
bulkIdentifyMaxCount = 100
15+
BulkIdentifyMaxCount = 100
1616
DefaultRealtimeBaseUrl = "https://realtime.flagsmith.com/"
1717
)
1818

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
inverseOperationIds:
2+
# List operations used by Flagsmith's LaucnhDarkly importer here.
3+
- getProject
4+
- getEnvironmentsByProject
5+
- getFeatureFlags
6+
- getTags
7+
- getSegments
8+
unusedComponents:
9+
- schemas
10+
- parameters
11+
- examples
12+
- headers
13+
- requestBodies
14+
- responses

flagengine/environments/models.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package environments
22

33
import (
4+
"time"
5+
46
"github.com/Flagsmith/flagsmith-go-client/v4/flagengine/features"
57
"github.com/Flagsmith/flagsmith-go-client/v4/flagengine/identities"
68
"github.com/Flagsmith/flagsmith-go-client/v4/flagengine/projects"
7-
"time"
89
)
910

1011
type EnvironmentModel struct {

flagengine/projects/models.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ type ProjectModel struct {
99
ID int `json:"id"`
1010
Name string `json:"name"`
1111
HideDisabledFlags bool `json:"hide_disabled_flags"`
12-
Organization *organisations.OrganisationModel `json:"organization"`
12+
Organisation *organisations.OrganisationModel `json:"organisation"`
1313
Segments []*segments.SegmentModel `json:"segments"`
1414
}

flagengine/utils/fixtures/fixtures.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func Segment(rule *segments.SegmentRuleModel) *segments.SegmentModel {
4141
}
4242
}
4343

44-
func Organization() *organisations.OrganisationModel {
44+
func Organisation() *organisations.OrganisationModel {
4545
return &organisations.OrganisationModel{
4646
ID: 1,
4747
Name: "test Org",
@@ -55,7 +55,7 @@ func Project(org *organisations.OrganisationModel, segment *segments.SegmentMode
5555
return &projects.ProjectModel{
5656
ID: 1,
5757
Name: "Test Project",
58-
Organization: org,
58+
Organisation: org,
5959
HideDisabledFlags: false,
6060
Segments: []*segments.SegmentModel{segment},
6161
}
@@ -146,7 +146,7 @@ func EnvironmentWithSegmentOverride(
146146
func GetFixtures() (*features.FeatureModel, *features.FeatureModel, *segments.SegmentModel, *environments.EnvironmentModel, *identities.IdentityModel) {
147147
feature1 := Feature1()
148148
feature2 := Feature2()
149-
org := Organization()
149+
org := Organisation()
150150
cond := SegmentCondition()
151151
rule := SegmentRule(cond)
152152
segment := Segment(rule)

0 commit comments

Comments
 (0)