mirror of https://github.com/usememos/memos.git
fix(lint): fix 4 golangci-lint failures on main branch
- idp_service.go: correct Scopes field alignment to col 13 (was 5 spaces, needs 6 to match AuthUrl/TokenUrl/UserInfoUrl group); revert over-correction from previous commit that wrongly added FieldMapping to the alignment group - instance_service.go: add default case to switch on updateSetting.Key to satisfy revive switch-without-default rule - memo_service.go: fix unchecked type assertion in isSSESuppressed; use ok && v pattern instead of discarding the ok bool - sse_service_test.go: remove unused drainEvents helper function https://claude.ai/code/session_01DVhwUL8RG8HVrcChv5qHdh
This commit is contained in:
parent
21a5f541c9
commit
f341f8cf40
|
|
@ -182,10 +182,10 @@ func convertIdentityProviderFromStore(identityProvider *storepb.IdentityProvider
|
|||
Oauth2Config: &v1pb.OAuth2Config{
|
||||
ClientId: oauth2Config.ClientId,
|
||||
// ClientSecret is write-only: never returned in responses.
|
||||
AuthUrl: oauth2Config.AuthUrl,
|
||||
TokenUrl: oauth2Config.TokenUrl,
|
||||
UserInfoUrl: oauth2Config.UserInfoUrl,
|
||||
Scopes: oauth2Config.Scopes,
|
||||
AuthUrl: oauth2Config.AuthUrl,
|
||||
TokenUrl: oauth2Config.TokenUrl,
|
||||
UserInfoUrl: oauth2Config.UserInfoUrl,
|
||||
Scopes: oauth2Config.Scopes,
|
||||
FieldMapping: &v1pb.FieldMapping{
|
||||
Identifier: oauth2Config.FieldMapping.Identifier,
|
||||
DisplayName: oauth2Config.FieldMapping.DisplayName,
|
||||
|
|
|
|||
|
|
@ -127,6 +127,8 @@ func (s *APIV1Service) UpdateInstanceSetting(ctx context.Context, request *v1pb.
|
|||
storage.S3Config.AccessKeySecret = existing.S3Config.AccessKeySecret
|
||||
}
|
||||
}
|
||||
default:
|
||||
// No credential preservation needed for other setting types.
|
||||
}
|
||||
|
||||
instanceSetting, err := s.Store.UpsertInstanceSetting(ctx, updateSetting)
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ func withSuppressSSE(ctx context.Context) context.Context {
|
|||
}
|
||||
|
||||
func isSSESuppressed(ctx context.Context) bool {
|
||||
v, _ := ctx.Value(suppressSSEKey{}).(bool)
|
||||
return v
|
||||
v, ok := ctx.Value(suppressSSEKey{}).(bool)
|
||||
return ok && v
|
||||
}
|
||||
|
||||
func (s *APIV1Service) CreateMemo(ctx context.Context, request *v1pb.CreateMemoRequest) (*v1pb.Memo, error) {
|
||||
|
|
|
|||
|
|
@ -32,20 +32,6 @@ func userCtx(ctx context.Context, userID int32) context.Context {
|
|||
return context.WithValue(ctx, auth.UserIDContextKey, userID)
|
||||
}
|
||||
|
||||
// drainEvents reads all events currently buffered in the channel and returns
|
||||
// them as a string slice. It stops as soon as the channel is empty (non-blocking).
|
||||
func drainEvents(ch <-chan []byte) []string {
|
||||
var out []string
|
||||
for {
|
||||
select {
|
||||
case data := <-ch:
|
||||
out = append(out, string(data))
|
||||
default:
|
||||
return out
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// collectEventsFor reads events from ch for the given duration and returns them.
|
||||
func collectEventsFor(ch <-chan []byte, d time.Duration) []string {
|
||||
var out []string
|
||||
|
|
|
|||
Loading…
Reference in New Issue