Skip to content

Remove dead code #2438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 63 commits into
base: main
Choose a base branch
from

Conversation

IvanCherepov
Copy link

@IvanCherepov IvanCherepov commented Jun 9, 2025

Fixes #1719

I can't reopen #2157 (locked and limited conversation to collaborators) --> created a new PR.

Before the last commit:

➜ spicedb git:(ivan-remove-dead-code-1719) deadcode -test ./... | grep -v pkg
internal/datastore/crdb/options.go:329:6: unreachable func: DebugAnalyzeBeforeStatistics
internal/datastore/mysql/options.go:218:6: unreachable func: DebugAnalyzeBeforeStatistics
internal/datastore/postgres/log_tracer.go:13:25: unreachable func: tracingLogger.Log
internal/datastore/postgres/options.go:341:6: unreachable func: DebugAnalyzeBeforeStatistics
internal/datastore/postgres/options.go:348:6: unreachable func: WithQueryInterceptor
internal/datastore/postgres/common/pgx.go:166:6: unreachable func: ConnectWithInstrumentation
internal/developmentmembership/trackingsubjectset.go:59:32: unreachable func: TrackingSubjectSet.RemoveFrom
internal/dispatch/combined/combined.go:129:6: unreachable func: RemoteDispatchTimeout
internal/graph/errors.go:59:6: unreachable func: NewAlwaysFailErr
internal/graph/errors.go:73:34: unreachable func: RelationNotFoundError.NamespaceName
internal/graph/errors.go:78:34: unreachable func: RelationNotFoundError.NotFoundRelationName
internal/graph/errors.go:82:34: unreachable func: RelationNotFoundError.MarshalZerologObject
internal/graph/errors.go:87:34: unreachable func: RelationNotFoundError.DetailsMetadata
internal/graph/errors.go:95:6: unreachable func: NewRelationNotFoundErr
internal/graph/errors.go:136:6: unreachable func: NewRelationMissingTypeInfoErr
internal/graph/errors.go:179:6: unreachable func: NewUnimplementedErr
internal/graph/graph.go:30:24: unreachable func: ExpandResult.ResultError
internal/graph/graph.go:38:6: unreachable func: AlwaysFailExpand
internal/logging/logger.go:39:6: unreachable func: Log
internal/logging/logger.go:43:6: unreachable func: Print
internal/logging/logger.go:47:6: unreachable func: Printf
internal/middleware/dispatcher/dispatcher.go:28:6: unreachable func: FromContext
internal/middleware/dispatcher/dispatcher.go:38:6: unreachable func: MustFromContext
internal/services/shared/errors.go:109:6: unreachable func: AsValidationError
internal/services/shared/interceptor.go:16:50: unreachable func: WithUnaryServiceSpecificInterceptor.UnaryInterceptor
internal/services/v0/developer.go:26:6: unreachable func: RegisterDeveloperServer
internal/testfixtures/generator.go:18:6: unreachable func: RandomObjectID


After the last commit:

➜ spicedb git:(ivan-remove-dead-code-1719) ✗ deadcode -test ./... | grep -v pkg
internal/datastore/crdb/options.go:329:6: unreachable func: DebugAnalyzeBeforeStatistics
internal/datastore/mysql/options.go:218:6: unreachable func: DebugAnalyzeBeforeStatistics
internal/datastore/postgres/options.go:341:6: unreachable func: DebugAnalyzeBeforeStatistics
internal/datastore/postgres/options.go:348:6: unreachable func: WithQueryInterceptor
internal/datastore/postgres/common/pgx.go:166:6: unreachable func: ConnectWithInstrumentation
internal/dispatch/combined/combined.go:129:6: unreachable func: RemoteDispatchTimeout
internal/graph/errors.go:59:6: unreachable func: NewAlwaysFailErr
internal/graph/errors.go:77:6: unreachable func: NewRelationNotFoundErr
internal/graph/errors.go:86:34: unreachable func: RelationNotFoundError.NamespaceName
internal/graph/errors.go:91:34: unreachable func: RelationNotFoundError.NotFoundRelationName
internal/graph/errors.go:128:6: unreachable func: NewRelationMissingTypeInfoErr
internal/graph/errors.go:171:6: unreachable func: NewUnimplementedErr
internal/graph/graph.go:35:6: unreachable func: AlwaysFailExpand
internal/logging/logger.go:39:6: unreachable func: Log
internal/logging/logger.go:43:6: unreachable func: Print
internal/logging/logger.go:47:6: unreachable func: Printf
internal/middleware/dispatcher/dispatcher.go:28:6: unreachable func: FromContext
internal/middleware/dispatcher/dispatcher.go:38:6: unreachable func: MustFromContext
internal/services/shared/errors.go:109:6: unreachable func: AsValidationError
internal/services/shared/interceptor.go:45:50: unreachable func: WithUnaryServiceSpecificInterceptor.UnaryInterceptor
internal/services/v0/developer.go:26:6: unreachable func: RegisterDeveloperServer
internal/testfixtures/generator.go:18:6: unreachable func: RandomObjectID

ivan and others added 30 commits December 5, 2024 12:21
…tFoundErr

internal/graph/errors.go:136:6: unreachable func: NewRelationMissingTypeInfoErr
…ternal/logging/logger.go:47:6: unreachable func: Printf
… func: FromContext and internal/middleware/dispatcher/dispatcher.go:38:6: unreachable func: MustFromContext
…c: WithUnaryServiceSpecificInterceptor.UnaryInterceptor
…43: cannot use RelationNotFoundError{} (value of type RelationNotFoundError) as sharederrors.UnknownRelationError value in variable declaration: RelationNotFoundError does not implement sharederrors.UnknownRelationError (missing method NamespaceName)
…43: cannot use RelationNotFoundError{} (value of type RelationNotFoundError) as sharederrors.UnknownRelationError value in variable declaration: RelationNotFoundError does not implement sharederrors.UnknownRelationError (missing method NotFoundRelationName)
…erceptor.go:44:45: cannot use WithUnaryServiceSpecificInterceptor{} (value of type WithUnaryServiceSpecificInterceptor) as servicespecific.ExtraUnaryInterceptor value in variable declaration: WithUnaryServiceSpecificInterceptor does not implement servicespecific.ExtraUnaryInterceptor (missing method UnaryInterceptor)
…spatcher.go:13:22: undefined: dispatchermw.FromContext
…able func: WithUnaryServiceSpecificInterceptor.UnaryInterceptor"

This reverts commit 441cda7.
…eachable func: FromContext and internal/middleware/dispatcher/dispatcher.go:38:6: unreachable func: MustFromContext"

This reverts commit ff9785d.
…nt an internal/logging/logger.go:47:6: unreachable func: Printf"

This reverts commit 2cafd77.
…tionNotFoundError.DetailsMetadata"

This reverts commit 5587d0c.
…FoundError.MarshalZerologObject"

This reverts commit da1f8fb.
…tionNotFoundError.NotFoundRelationNa"

This reverts commit 45e8077.
…tionNotFoundError.NamespaceName"

This reverts commit fed7efb.
…ble func: RemoteDispatchTimeout"

This reverts commit 94d707b.
…chable func: ConnectWithInstrumentation"

This reverts commit 8b2f9f3.
…ble func: WithQueryInterceptor"

This reverts commit feb1a98.
…c: DebugAnalyzeBeforeStatistic"

This reverts commit 7bb1f2b.
…chable func: tracingLogger.Log"

This reverts commit c005116.
… func: DebugAnalyzeBeforeStatistics"

This reverts commit 0ceb39e.
…func: DebugAnalyzeBeforeStatistics"

This reverts commit 0e1f6bc.
@IvanCherepov IvanCherepov requested a review from a team as a code owner June 9, 2025 21:34
@IvanCherepov
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

Copy link

github-actions bot commented Jun 9, 2025

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


1 out of 2 committers have signed the CLA.
✅ (IvanCherepov)[https://github.com/IvanCherepov]
@ivan
ivan seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request

@github-actions github-actions bot added the area/datastore Affects the storage system label Jun 9, 2025
authzedbot added a commit to authzed/cla that referenced this pull request Jun 9, 2025
Copy link
Contributor

@vroldanbet vroldanbet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution, please clean up the commit history (one single commit) and undo superfluous changes. Also please use the same commit author as the GitHub user otherwise the CLA check won't pass

Comment on lines +85 to +94
// NamespaceName returns the name of the namespace in which the relation was not found.
func (err RelationNotFoundError) NamespaceName() string {
return err.namespaceName
}

// NotFoundRelationName returns the name of the relation not found.
func (err RelationNotFoundError) NotFoundRelationName() string {
return err.relationName
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change seems superfluous

@@ -45,6 +41,11 @@ func (wssi WithServiceSpecificInterceptors) StreamInterceptor() grpc.StreamServe
return wssi.Stream
}

// UnaryInterceptor implements servicespecific.ExtraUnaryInterceptor
func (wussi WithUnaryServiceSpecificInterceptor) UnaryInterceptor() grpc.UnaryServerInterceptor {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change seems superfluous

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/datastore Affects the storage system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove statically analyzable dead-code
2 participants