Skip to content

Remove unused embedded struct#3402

Merged
mislav merged 1 commit intocli:trunkfrom
cristiand391:remove-unused-embedded-struct
Apr 20, 2021
Merged

Remove unused embedded struct#3402
mislav merged 1 commit intocli:trunkfrom
cristiand391:remove-unused-embedded-struct

Conversation

@cristiand391
Copy link
Contributor

This PR removes an unused embedded struct declared in type PullRequest struct.

It looks like the linter used by golangci-lint to found unused struct fields doesn't handle embedded structs yet.

Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

Thank you!

I do not think that this is an embedded struct. Instead, what I think is happening is that the unused linter considers any exported type or field to be potentially used (even if it's not used from our own codebase). Since everything about api.PullRequest.HeadRepository.DefaultBranchRef is exported, it is not checked by unused linter. We probably have a lot more exported structs/fields/methods that are dead code; i.e. unused in our own codebase.

I wish that there was a version of unused that also checks exported identifiers, but alas, I did not find one.

@mislav mislav merged commit 47b7987 into cli:trunk Apr 20, 2021
@cristiand391 cristiand391 deleted the remove-unused-embedded-struct branch April 20, 2021 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants