Skip to content
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

Remove dead-code #2157

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

Conversation

IvanCherepov
Copy link

Addresses the most of dead-code from #1719

➜ spicedb git:(main) deadcode -test ./... | grep -v pkg

internal/datasets/subjectsetbytype.go:93:28: unreachable func: SubjectByTypeSet.Len
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

➜ spicedb git:(ivan-remove-dead-code-1719) deadcode -test ./... | grep -v pkg

internal/graph/errors.go:65:34: unreachable func: RelationNotFoundError.NamespaceName
internal/graph/errors.go:70:34: unreachable func: RelationNotFoundError.NotFoundRelationName
internal/middleware/dispatcher/dispatcher.go:28:6: unreachable func: FromContext
internal/services/shared/errors.go:109:6: unreachable func: AsValidationError
internal/services/shared/interceptor.go:16:50: unreachable func: WithUnaryServiceSpecificInterceptor.UnaryInterceptor

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
…reachable func: TrackingSubjectSet.RemoveFrom
@IvanCherepov IvanCherepov requested review from vroldanbet and a team as code owners December 7, 2024 04:24
@github-actions github-actions bot added area/api v0 Affects the v0 API area/datastore Affects the storage system area/dispatch Affects dispatching of requests labels Dec 7, 2024
Copy link

github-actions bot commented Dec 7, 2024

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


0 out of 2 committers have signed the CLA.
@ivan
@IvanCherepov
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

@vroldanbet
Copy link
Contributor

Hey Ivan, appreciate the PR, but we can't blindly accept this. Many of these functions are exported, which means that Go code importing SpiceDB would break. I'd suggest removing only unexported code to begin with.

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

Successfully merging this pull request may close these issues.

2 participants