Skip to content

Commit 72de17a

Browse files
rhnvrmampcode-com
andcommitted
fix: linting issues for GitHub Actions CI
Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-cafc9ebb-a4d3-4752-a6eb-d41c8bd2b149
1 parent 40a2278 commit 72de17a

15 files changed

+531
-53
lines changed

app/app.go.backup

Lines changed: 488 additions & 0 deletions
Large diffs are not rendered by default.

kc/manager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func (m *Manager) GetAuthenticatedClient(sessionID string) (*kiteconnect.Client,
126126
}
127127

128128
if time.Now().After(session.Credentials.ExpiresAt) {
129-
return nil, errors.New("Kite session has expired (24-hour limit). Please use the login tool to refresh")
129+
return nil, errors.New("kite session has expired (24-hour limit). Please use the login tool to refresh")
130130
}
131131

132132
client := kiteconnect.New(m.apiKey)
@@ -213,4 +213,4 @@ func setupTemplates() (map[string]*template.Template, error) {
213213
out[templateName] = templ
214214
}
215215
return out, nil
216-
}
216+
}

kc/manager_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ func TestNewManager(t *testing.T) {
8585
t.Fatalf("Expected no error creating manager, got: %v", err)
8686
}
8787

88-
if manager == nil {
89-
t.Fatal("Expected non-nil manager")
90-
}
91-
9288
if manager.apiKey != apiKey {
9389
t.Errorf("Expected API key %s, got %s", apiKey, manager.apiKey)
9490
}
@@ -273,4 +269,4 @@ func TestSessionSigner(t *testing.T) {
273269
if verifiedSessionID != testSessionID {
274270
t.Errorf("Expected verified session ID %s, got %s", testSessionID, verifiedSessionID)
275271
}
276-
}
272+
}

kc/session.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ func (sm *SessionManager) copySession(original *Session) *Session {
275275
ExpiresAt: original.ExpiresAt,
276276
OAuthData: original.OAuthData, // Shallow copy - assuming immutable
277277
}
278-
278+
279279
// Deep copy credentials if present
280280
if original.Credentials != nil {
281281
copy.Credentials = &KiteCredentials{
@@ -284,6 +284,6 @@ func (sm *SessionManager) copySession(original *Session) *Session {
284284
ExpiresAt: original.Credentials.ExpiresAt,
285285
}
286286
}
287-
287+
288288
return copy
289-
}
289+
}

kc/session_signing.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,4 @@ func (s *SessionSigner) VerifyRedirectParams(redirectParams string) (string, err
172172
}
173173

174174
return s.VerifySessionID(signedSessionID)
175-
}
175+
}

kc/session_signing_test.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ func TestNewSessionSigner(t *testing.T) {
1212
t.Fatalf("Expected no error creating session signer, got: %v", err)
1313
}
1414

15-
if signer == nil {
16-
t.Fatal("Expected non-nil session signer")
17-
}
18-
1915
if len(signer.secretKey) != 32 {
2016
t.Errorf("Expected secret key length 32, got %d", len(signer.secretKey))
2117
}
@@ -29,10 +25,6 @@ func TestNewSessionSignerWithKey(t *testing.T) {
2925
testKey := []byte("test-key-32-bytes-long-for-hmac")
3026
signer := NewSessionSignerWithKey(testKey)
3127

32-
if signer == nil {
33-
t.Fatal("Expected non-nil session signer")
34-
}
35-
3628
if len(signer.secretKey) != len(testKey) {
3729
t.Errorf("Expected secret key length %d, got %d", len(testKey), len(signer.secretKey))
3830
}
@@ -196,4 +188,4 @@ func TestValidateSessionID(t *testing.T) {
196188
if err != nil {
197189
t.Errorf("Expected no error for valid session ID, got: %v", err)
198190
}
199-
}
191+
}

kc/session_test.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ import (
1515
func TestNewSessionManager(t *testing.T) {
1616
manager := NewSessionManager(testLogger())
1717

18-
if manager == nil {
19-
t.Fatal("Expected non-nil manager")
20-
}
21-
2218
if manager.sessionDuration != DefaultSessionDuration {
2319
t.Errorf("Expected default duration of %v, got %v", DefaultSessionDuration, manager.sessionDuration)
2420
}
@@ -101,10 +97,6 @@ func TestGetOrCreate(t *testing.T) {
10197
t.Error("Expected isNew to be true for first call")
10298
}
10399

104-
if session == nil {
105-
t.Fatal("Expected non-nil session")
106-
}
107-
108100
if session.ID != sessionID {
109101
t.Errorf("Expected session ID %s, got %s", sessionID, session.ID)
110102
}
@@ -123,7 +115,7 @@ func TestGetOrCreate(t *testing.T) {
123115
if session2.ID != session.ID {
124116
t.Error("Expected sessions to have the same ID")
125117
}
126-
118+
127119
if session2.CreatedAt != session.CreatedAt {
128120
t.Error("Expected sessions to have the same CreatedAt time")
129121
}
@@ -385,7 +377,7 @@ func TestConcurrentSessionCreation(t *testing.T) {
385377
func TestConcurrentSessionTermination(t *testing.T) {
386378
manager := NewSessionManager(testLogger())
387379
const numGoroutines = 20
388-
380+
389381
// Create multiple sessions
390382
sessionIDs := make([]string, numGoroutines)
391383
for i := 0; i < numGoroutines; i++ {
@@ -476,4 +468,4 @@ func TestConcurrentCleanup(t *testing.T) {
476468
if remaining != 0 {
477469
t.Errorf("Expected 0 sessions remaining after cleanup, got %d", remaining)
478470
}
479-
}
471+
}

mcp/common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,4 +272,4 @@ func PaginatedToolHandler[T any](manager *kc.Manager, toolName string, apiCall f
272272
return handler.MarshalResponse(responseData, toolName)
273273
})
274274
}
275-
}
275+
}

mcp/get_tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,4 +243,4 @@ func (*OrderHistoryTool) Handler(manager *kc.Manager) server.ToolHandlerFunc {
243243
return handler.MarshalResponse(orderHistory, "get_order_history")
244244
})
245245
}
246-
}
246+
}

mcp/market_tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,4 @@ func (*OHLCTool) Handler(manager *kc.Manager) server.ToolHandlerFunc {
278278
return handler.MarshalResponse(ohlc, "get_ohlc")
279279
})
280280
}
281-
}
281+
}

0 commit comments

Comments
 (0)